• 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 don't return what I wait
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sort don't return what I wait


  • Subject: Re: Sort don't return what I wait
  • From: "Mark J. Reed" <email@hidden>
  • Date: Mon, 16 Jun 2008 13:47:21 -0400

On Mon, Jun 16, 2008 at 1:32 PM, KOENIG Yvan <email@hidden> wrote:
> In fact, I'm writing a script for a Pages user which want to concatenate
> more than 400 Pages documents in a single one.
> My guess is that its docs are of the kind "myDoc001.pages"
> …
> "myDoc401.pages"

If you run into a situation where the numbers are not all the same
number of digits, you can use the -k (key) and -n (numeric) options.
For instance:

sort -k1.6 -n

Would correctly sort "myDoc4.pages" before "myDoc101.pages".  -k1.6
says that the sort key starts with the 6th character of the first
field, so it skips the "myDoc" part of the filename, and the -n says
that the keys should be compared as numbers instead of strings.  That
trick only works if all the filenames start with the same prefix
string, of course.







--
Mark J. Reed <email@hidden>
 _______________________________________________
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 don't return what I wait (From: KOENIG Yvan <email@hidden>)
 >Re: Sort don't return what I wait (From: KOENIG Yvan <email@hidden>)
 >Re: Sort don't return what I wait (From: "Mark J. Reed" <email@hidden>)
 >Re: Sort don't return what I wait (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re: Sort don't return what I wait
  • Next by Date: Re: osacompile
  • Previous by thread: Re: Sort don't return what I wait
  • Next by thread: Get name of desktop image. Is this a bug?
  • Index(es):
    • Date
    • Thread