Re: Sort don't return what I wait
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