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 11:05:23 -0400
On May 18, 2004, at 4:26 AM, Paul Berkowitz wrote:
On 5/18/04 12:58 AM, "Graff" <email@hidden> wrote:
Hmm, a bit more testing reveals that this script:
----
set someLines to quoted form of "1
2
3
4
5
6"
do shell script "echo " & someLines & " | sed '/2/,/5/d'"
----
Works fine in Script Editor but doesn't work in Script Debugger.
In Script Editor it returns:
"1
6"
In Script Debugger it returns:
""
So it does appear that Script Debugger may have some issues with the
"do shell script command"
You quite sure that it doesn't involve the fact that within strings
carriage
returns typed in Script Debugger are /r (ASCII 13) whereas carriage
returns
typed in Script Editor 2.0 are /n (ASCII 10) as preferred by Unix
commands?
Just replace the <return> between lines (in SD) with a line feed to
check.
Ahh, I didn't know that Script Debugger differed from Script Editor in
that respect. I don't normally use Script Debugger, I just downloaded
the demo to test this for Gnarlie.
You're right, that would probably do it. I went the other route and
converted the \n to \r in Script Editor and it didn't work.
----
set someLines to quoted form of "1
2
3
4
5
6"
do shell script "echo " & someLines & " | tr '\\n' '\\r' | sed
'/2/,/5/d'"
-->""
----
When I went the other way and converted \r to \n it did work:
----
set someLines to quoted form of "1
2
3
4
5
6"
do shell script "echo " & someLines & " | tr '\\r' '\\n' | sed
'/2/,/5/d'"
-->"1
-->6"
----
So it looks like this is a case of Script Debugger using the wrong line
ending for a shell command.
- Ken
_______________________________________________
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.