How to have sort start sorting froma given column?

How to have sort start sorting froma given column?

Post by Mark Now » Tue, 19 Jan 1999 04:00:00



Hi,

I'd like to know if there is a way to use sort (or anything else) to
start sorting based on text that starts at a given column, say column 42.

Thanks!

Mark
--
Mark Nowak    Chicago, Illinois  



 
 
 

How to have sort start sorting froma given column?

Post by Barry Margoli » Tue, 19 Jan 1999 04:00:00




>I'd like to know if there is a way to use sort (or anything else) to
>start sorting based on text that starts at a given column, say column 42.

sort +0.42

means that the sort key starts with character 42 of field 0 (note: both the
character and field numbers start counting at 0).

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.

 
 
 

How to have sort start sorting froma given column?

Post by Thomas L|fgre » Wed, 20 Jan 1999 04:00:00


    MN> Hi, I'd like to know if there is a way to use sort (or
    MN> anything else) to start sorting based on text that starts at a
    MN> given column, say column 42.

The answer is yes, which you would have known if you had bothered
reading the manual.

Tom
--
Wherever I lay my .emacs, that's my ${HOME}

 
 
 

How to have sort start sorting froma given column?

Post by Barry Margoli » Wed, 20 Jan 1999 04:00:00





>    MN> Hi, I'd like to know if there is a way to use sort (or
>    MN> anything else) to start sorting based on text that starts at a
>    MN> given column, say column 42.

>The answer is yes, which you would have known if you had bothered
>reading the manual.

Could you quote the part of the man page that answers this?  It's hardly
obvious.  The manual talks alot about key fields, but the word "column"
never appears (at least not in my Solaris 2.5.1 man page).  There's even a
paragraph that could be interpreted as saying that in a
field_number.first_char specification, the first_char can't go beyond the
length of the field:

               A field  comprises  a  maximal  sequence  of  non-
               separating  characters  and,  in  the  absence  of
               option -t, any preceding field separator.

However, it turns out that there's no restriction on the first_char; this
definition is just used to determine where each field starts.

There are 5 examples in the EXAMPLES section of the man page, but none of
them show how to sort on a specific column, they're all by field.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Don't bother cc'ing followups to me.

 
 
 

1. SORT command > sorting decimal numbers in columns on a file not working !

Hi. I try to sort a column on a file containing decimal numbers. I use
Sse Linux 9.1. Then I try to do this:


doasidpoas   opipo     7.8
kjkljkljklji   kjklj   35.7
kljkljkl       kljkl   2.3
dopasidp       poipo   0.2
kjkljlkl       kjkl    0.0
kljkljkjl      ljlk    0.8
jklhkljkl      kjkl    0.0
kljkljkljl     kjkl    0.1

dopasidp       poipo   0.2
jklhkljkl      kjkl    0.0
kjkljlkl       kjkl    0.0
kljkljkjl      ljlk    0.8
kljkljkljl     kjkl    0.1
kljkljkl       kljkl   2.3
doasidpoas   opipo     7.8
kjkljkljklji   kjklj   35.7

kjkljkljklji   kjklj   35.7
doasidpoas   opipo     7.8
kljkljkl       kljkl   2.3
kljkljkljl     kjkl    0.1
kljkljkjl      ljlk    0.8
kjkljlkl       kjkl    0.0
jklhkljkl      kjkl    0.0
dopasidp       poipo   0.2

As you can see the sorting order is not correct. What am I doing wrong ?
I also tried to use '-g' option instead of '-n' but doesnt work.

Any idea ?

Thanks
Alberto

2. Getting xdm to work w/SlackWare 3.4, AccelX 4.1 & KDE?

3. sort sort: 0653-657 A write error occurred while sorting (4.1.3)

4. Why does the OpenBSD partition start at sector 63?

5. Sorting By Second Column With Unique First Column

6. Bug in fileutils-3.5, chmod +x doesn't work?

7. sort: write error while sorting: No space left on device??

8. only root can print

9. "sort" sorting uppercase/lowercase differently on different boxes

10. Sorting without "sort" ?

11. default secondary sort line in 'sort'

12. (sort | uniq) vs (sort -u)

13. bash - sort command - can I sort by a certain field?