Re: Sorting IP addresses
Re: Sorting IP addresses
- Subject: Re: Sorting IP addresses
- From: Deivy Petrescu <email@hidden>
- Date: Sat, 20 Dec 2003 13:52:34 -0500
At 6:05 PM +0100 12/20/03, Emmanuel wrote:
At 12:23 AM +0800 21/12/03, Bill wrote:
Marconi,
An alternative: using the shell command "sort".
Suppose a file records IP addresses, each in a
new paragraph, with unix line ending, then you
may try this one:
-- choose the file
set tmpPOSIX to quoted form of POSIX path of (choose file)
-- brief explanation: using . as field seperator, sort field 0-3 numerically
-- the first field is field 0, output the
result to a file named "sortedIP.txt" on your
desktop
>do shell script "sort -t. +0n +1n +2n +3n " &
tmpPOSIX & " > ~/Desktop/sortedIP.txt"
And you say that only now? :-)
Thanks for that one!
Emmanuel
I have not received the original message.
As Marconi, I did not get the command to sort all
four fields in numerical order.
If it does work, a better way to write it is
do shell script "sort -t. +0n +1n +2n +3n
~/Desktop/sortedIP.txt -o ~/Desktop/sortedIP.txt"
The "-o" option allows the system to do its dirty trick under the hood.
If anybody managed to get all 4 fileds sorted
this way, could I get a message please?
Thanks
--
Regards
Saudagues
Deivy
http://www.dicas.com
_______________________________________________
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.