Re: a two-level 'sort' question
From: Bill Marcum (bmarcum_at_iglou.com.urgent)
Date: 03/29/05
- Next message: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Previous message: Bill Marcum: "Re: SCO UNIX v/386 RELEASE 3.2 version 2.0"
- In reply to: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Next in thread: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Reply: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Mar 2005 15:04:55 -0500
On 29 Mar 2005 09:13:37 -0800, subPlanck@excite.com
<subPlanck@excite.com> wrote:
>
> Bill Seivert wrote:
>> >
>> >>I'm stuck trying to sort a long list of files in the form:
>> >>
>> >>Feb 24 13:50 060399_20a08.124
>> >>Feb 22 12:06 060399_20a09.035
>> >>Feb 22 12:06 060399_20a09.034
>> >>
>> >>whereby the entries are first sorted/grouped by
>> >>sort -t_ -d -k 2.1,2.5
>> >>and each block is sorted in an ascending order by date.
> [...]
>> Try:
>> sort -t_ -d -k 2.1,2.5 -k 1.1M,1.3 -k 1.5n,1.6 -k 1.7n,1.8 -k
> 1.10n,1.11
>> -k 1.14n,1.19
>
> This works the way I wanted it to work, thanks, but what made 'sort'
> change its separator from an underscore to a space in the M term?
The separator doesn't have to change. "-k 1.1M,1.3" tells sort to look
at only the first three characters, and likewise for the other -k
expressions. Only the "-k 2.1,2.5" depends on the separator.
-- "I deleted a file from my PC last week and I have just realized that I need it. If I turn my system clock back two weeks will I have my file back again?"
- Next message: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Previous message: Bill Marcum: "Re: SCO UNIX v/386 RELEASE 3.2 version 2.0"
- In reply to: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Next in thread: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Reply: subPlanck_at_excite.com: "Re: a two-level 'sort' question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|