Re: sort on single item only
- From: Jon LaBadie <jXlabadie@xxxxxxxxx>
- Date: Tue, 31 Mar 2009 17:30:30 GMT
Lao Ming wrote:
On Mar 30, 10:40 am, Martin Trautmann <t-...@xxxxxxx> wrote:On Mon, 30 Mar 2009 10:32:24 -0700 (PDT), Lao Ming wrote:On Mar 30, 2:00 am, pk <p...@xxxxxxxxxx> wrote:What's your sort field?On Monday 30 March 2009 07:02, Lao Ming wrote:Well, that's not quite what I meant. Of course, now that I thinkWhat if the column delimiters were either spaces or, say, tildes.Man sort, option -t
Could it still be done?
about it, what I meant was probably just wishful thinking. For the
most part, the fields look like this:
1234 ABC 56 one-large-text-field
However, they can also look like this (below) since the first field is
actually five chars, the 2nd field is actually four chars. The 3rd
field, however, is always just two chars.
1234~ABC~56 one-large-text-field
If it can be done, I'd still really love to know how.
You want to sort by 56?
sort -t"~" -k3,3
I do not understand yet where POS1 starts counting - I would expect one
less instead. But that's something which sort can do very well.
- Martin
No, the data looks like this:
1234~ABC~56 one-large-text-field
4321 ZYX 65 more text
2009~FTP 21 still more text
Thus, the first five characters are always field 1, the next 4 chars
are always field 2, columns 10-11 are always field 3 and 13 and beyond
are always field 4.
sort -t<char_NOT_in_records> -k 1.1,1.5 -k 1.6,1.9 -k 1.10,1.11 -k 1.12
.
- References:
- Re: sort on single item only
- From: OldSchool
- Re: sort on single item only
- From: Lao Ming
- Re: sort on single item only
- From: pk
- Re: sort on single item only
- From: Lao Ming
- Re: sort on single item only
- From: Lao Ming
- Re: sort on single item only
- Prev by Date: Re: Code review: timeout in a shell script
- Next by Date: Re: Is there any way to grep and get this result?
- Previous by thread: Re: sort on single item only
- Next by thread: Re: sort on single item only
- Index(es):
Relevant Pages
|