• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OT] UNIX heads; can I do this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Email Change because of SPAM... (Sorry for the RESEND) (From: Don Wieland <email@hidden>)
 >[OT] UNIX heads; can I do this? (From: Bill Briggs <email@hidden>)
 >Re: [OT] UNIX heads; can I do this? (From: John Hawkinson <email@hidden>)

  • Prev by Date: Re: [OT] UNIX heads; can I do this?
  • Next by Date: Re: [OT] UNIX heads; can I do this?
  • Previous by thread: Re: [OT] UNIX heads; can I do this?
  • Next by thread: Re: [OT] UNIX heads; can I do this?
  • Index(es):
    • Date
    • Thread