Re: Sorting IP addresses - Progress
Re: Sorting IP addresses - Progress
- Subject: Re: Sorting IP addresses - Progress
- From: Bill <email@hidden>
- Date: Mon, 22 Dec 2003 12:04:05 +0800
In reality, the shell sort , i.e. "sort -n -t.
..." is the fastest method and I'd think also the
easiest to program.
The only caveat, the file has to have Unix ending, not Mac ending.
Deivy,
You may consider the shell command tr
tr '\r' '\n' < unsortedfile |sort -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4
|tr '\n' '\r' > sortedfile
Briefly,
tr '\r' '\n' < unsortedfile
translate (convert) every return character to linefeed character from
the file named "unsortedfile",
sort -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4
sort it :)
tr '\n' '\r' > sortedfile
translate every linefeed character to return character, output the
result to the file named "sortedfile"
A little cavert :)
bill
PS: [OT] one more testing
B+rawB;B,
B+eventB;
_______________________________________________
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.