Hi,
It's not clear if the lines in the file are one long line or if they are divided into fields.
If the last is the case, you can use sort alone to do this:
sort -k<fieldnumber> infile
This is the global form, a space being the field separator.
Here's a real example:
Quote:
$ cat infile
54321:333:9876
12345:222:6789
12345:444:6789
12345:111:6789
$ sort -t":" -k2 infile
12345:111:6789
12345:222:6789
54321:333:9876
12345:444:6789
|
The -t option can be used to set the actual separator (not a space in this case, but a semicolon).
Hope this helps.
PS: Don't crosspost........