Re: Q: echo | sed -- Solved!
Re: Q: echo | sed -- Solved!
- Subject: Re: Q: echo | sed -- Solved!
- From: Graff <email@hidden>
- Date: Tue, 18 May 2004 03:44:11 -0400
Hmm, just give this one last try if you would:
----
set someLines to quoted form of "1
2
3
4
5
6"
do shell script "echo " & someLines & " | sed 's/2/8/'"
----
and:
----
set someLines to "1
2
3
4
5
6"
do shell script "echo " & quoted form of someLines & " | sed 's/2/8/'"
----
Does either one of those work? Is there any difference in the output
between them? I'm just wondering what made the script work since the
only thing that we did different was to change at what point we used
"quoted form of".
For what it's worth, both versions work just fine for me in Script
Editor. I downloaded the demo of Script Debugger and both versions of
the scrips worked fine in it also.
- Ken
On May 18, 2004, at 1:28 AM, Gnarlodious wrote:
It works!
Here it is as a one liner:
set someLines to do shell script "echo " & quoted form of someLines &
" | tr
-s '\\r' '\\n' | sed '/2/,/5/d'"
In this script the quoted form is not necessary but in any real life
script
characters will need escaping.
Apparently the unix line ending is necessary in this exact stream of
commands.
I don't know why the previous scripts worked for you but not for me or
why
the sed substitution works from echo but not a span of lines. The
idiosyncracies of Applescript...
Thanks for the help, this will be a very useful trick for all kinds of
jobs.
This script actually strips advertisements from Yahoo Group emails.
Thanks for the help!
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.