Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
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>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.