• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sorting IP addresses - Progress
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sorting IP addresses - Progress


  • Subject: Re: Sorting IP addresses - Progress
  • From: Deivy Petrescu <email@hidden>
  • Date: Mon, 22 Dec 2003 12:32:41 -0500

At 12:04 PM +0800 12/22/03, Bill wrote:
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


Excellent.
Thanks Bill. However, the last part should only be used *if* you want a Mac file not Unix. Which might not be the case.
Some apps use Unix file endings not Mac. Script Editor is one.

--
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.

References: 
 >Re: Sorting IP addresses - Progress (From: Bill <email@hidden>)

  • Prev by Date: Re: Getting time components of date
  • Next by Date: Re: escape key
  • Previous by thread: Re: Sorting IP addresses - Progress
  • Next by thread: Help! Need an AppleScript in a hurry! (Create text files based on file names)
  • Index(es):
    • Date
    • Thread