Re: do shell script "sort"?
Re: do shell script "sort"?
- Subject: Re: do shell script "sort"?
- From: Andrew Oliver <email@hidden>
- Date: Wed, 21 May 2003 23:48:06 -0700
The sort command takes stdin and sorts it. In your script you're just
calling "sort' without telling it what data to sort.
The following works for me (I removed the ascii character 4 since I don't
know what relevance it has);
set MyText to ("b" & (ASCII character 10) & "c" & (ASCII character 10) & "a"
& (ASCII character 10))
set ShellCommand to "echo " & quoted form of MyText & "| sort "
set theResult to do shell script ShellCommand
--> "
a
b
c"
You need to use the quoted form of the string to properly capture the line
breaks.
Andrew
:)
On 5/21/03 11:20 PM, "Joseph Weaks" <email@hidden> wrote:
>
I have tried the variations I can think of to use the sort unix utility
>
with the do shell script command. I'm guessing that it's not possible. It
>
sure would be a handy to sort a string of lines on the fly. I'm new at all
>
this unix stuff as it is. Any ideas?
>
Here's one version of the random gibberish I've tried:
>
>
>
set MyText to ("b" & (ASCII character 10) & "c" & (ASCII character 10) &
>
"a" & (ASCII character 10) & (ASCII character 4))
>
>
set ShellCommand to "sort; echo " & MyText
>
>
set theResult to do shell script ShellCommand
>
>
Thanks,
>
Joe Weaks
>
_______________________________________________
>
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.
_______________________________________________
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.