• 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: Re : [OT] UNIX heads; can I do this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re : [OT] UNIX heads; can I do this?


  • Subject: Re: Re : [OT] UNIX heads; can I do this?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 14 Jun 2007 10:16:59 -0400

This has long since wandered off-topic, but . . .

printf 'UN\rDEUX\rTROIS\rQUATRE' | sed 's/\'$'\r''/\'$'\n''/g'

I don't think going in and out of the different strings like that saves you anything over just doubling the backslashes in terms of legibility or typability; it just makes it even more confusing than shell syntax already is. I would just use a single $'...' string. And as long as you're using $'...' strings, why not use them in the first part, too? Then you can use a regular echo instead of a printf, and you don't even need -e.

echo $'UN\rDEUX\rTROIS\rQUATRE' | sed $'s/\\\r/\\\n/g'

Anyway, the important thing to know if for some reason you want to do
this with sed is exactly what sed wants to see: between the first
slashes, a backslash followed by a carriage return; between the second
slashes, a backslash followed by a newline.  There are lots of
different ways to convince the shell to pass an argument string to sed
that contains those characters in that order, and which you choose is
essentially irrelevant to the basic problem.

--
Mark J. Reed <email@hidden>
_______________________________________________
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: 
 >Re : [OT] UNIX heads; can I do this? (From: Clement Hoffmann <email@hidden>)

  • Prev by Date: Moving Word VBA to AS
  • Next by Date: INDESIGN: Storing Application-Specific Object References Externally
  • Previous by thread: Re : [OT] UNIX heads; can I do this?
  • Next by thread: Moving Word VBA to AS
  • Index(es):
    • Date
    • Thread