Re: [OT] UNIX heads; can I do this?
Re: [OT] UNIX heads; can I do this?
- Subject: Re: [OT] UNIX heads; can I do this?
- From: Bill Briggs <email@hidden>
- Date: Wed, 13 Jun 2007 17:41:49 -0300
At 4:23 PM -0400 6/13/07, John Hawkinson wrote:
>Bill Briggs <email@hidden> wrote on Wed, 13 Jun 2007
>at 16:54:31 -0300 in <p0623091cc295fa89b368@[131.202.97.88]>:
>
>
>> I want to take a text file with Mac (cr) line endings and change to
>> UNIX (lf) line endings (eventually I'm piping it to awk, which needs
>> the lf or it sees it all as one line).
>
>Pipe through
>
> tr \\015 \\012
>
>Note that you must pipe through it, i.e.
>
> tr \\015 \\012 < t.txt > b.txt
>
>you may *not* give a commandline argument to tr:
>
> tr \\015 \\012 t.txt > b.txt
>
>it will fail.
Piping it is.
> > sed -e 's/^M//g' t.txt | cat > b.txt
>
>p.s.: this construction wastes the cat...any instance of "| cat >" can
>always be replaced simply by ">" and save yourself a step.
>
>> Then again, maybe it's not possible to do that with sed, but I can't
>> see why not.
>
>Sed doesn't like to work with linebreaks, it likes to work the things
>between them.
I was getting that very strong impression.
>Trying to do it leads to more grief. Just use tr
>(or tr and sed together if you also need to perform other
>operations. i.e. tr \\015 \\012 < t.txt | sed s/nokia/iPhone/g > b.txt).
Once I get the line endings changed it's into awk for a column extraction. Just tried that and the output of my awk expression is what I need.
thanks,
- web
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden