• 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: Sort not case sensitive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort not case sensitive


  • Subject: Re: Sort not case sensitive
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 2 Jul 2010 09:56:51 +0200


Le 2 juil. 2010 à 00:31, Mark J. Reed a écrit :

On Thu, Jul 1, 2010 at 5:24 PM, Mark J. Reed <email@hidden> wrote:
Logically, sort -k1,1n -k2f should also work, but apparently -f is not a legal key-specific option in OS X's sort(1).


I take that back. The -k2f form works fine; I had an error in my command line. Apologies for the FUD.


Thanks to all of you. I respond to everybody in a single message.

In fact I have two parallel lists.
One store words from a text,
the other store the occurences of these words in a source text.
The numbers may vary from 1 to, say 999.

As I found no way to sort the two lists I concatenated the values with the separator <>

My example was a bad one because the numbers had the same lengths.
As the length of the numbers isn't fixed, the -n option is required
but I wish that the words are ordered alphabetically.

I wrote that yesterdays. I was so tired (here it was quite midnight) that I posted to Mark, not to the forum :-(

This morning I tested and saw that :

--[SCRIPT]
set unsortedList to {"12<>azertyuiop", "12<>Bzertyuiop", "12<>Azertyuiop", "10<>sdf", "6<>Azertyuiop"}


set AppleScript's text item delimiters to linefeed
set sortedList to paragraphs of ¬
(do shell script "echo " & quoted form of (unsortedList as string) & "| sort -t '<' -k1n -k2f")
set AppleScript's text item delimiters to ""
sortedList
--[/SCRIPT]


does exactly what I wanted.

Thank you again.

Yvan KOENIG (VALLAURIS, France) vendredi 2 juillet 2010 09:56:41




_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Sort not case sensitive (From: KOENIG Yvan <email@hidden>)
 >Re: Sort not case sensitive (From: "Mark J. Reed" <email@hidden>)
 >Re: Sort not case sensitive (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: controlling volume levels
  • Next by Date: Re: Sort not case sensitive
  • Previous by thread: Re: Sort not case sensitive
  • Next by thread: Re: Sort not case sensitive
  • Index(es):
    • Date
    • Thread