Re: Re : [OT] UNIX heads; can I do this?
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