🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1529

How to sort on exactly one field only

#1529
From: Anand Venkata Raman
Date: Tue, 23 Oct 1990 21:21
27 lines
1283 bytes
I want to sort a file exclusively on field #2.
For example,
A portion of the file looks like
appl1  3  Submitted
appl2  4  Submitted
appl1  3  Started
appl3  5  Submitted
appl2  4  Started
appl1  3  Finished(0)
appl2  4  Finished(7)
appl3  5  Started
appl3  5  Finished(3)

I want all applications with the same jobID (Second field) grouped together
and the whole file sorted by jobID.  Sort does that fine.  But within a single
jobID, it sorts using the status as the secondary field which puts the Finished
record before the Started and Submitted.

I tried using sort +1 -2, but that doesn't seem to deter sort from looking
at field #3.

The man page says sort +pos1 -pos2 means the key field begins at pos1 and ends
before pos2.  But that doesn't seem to be the case.

Thanks for any help. (email)

- & (Anand)
Technical Details
Message-ID: <1094@massey.ac.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!massey.ac.nz!ARaman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!massey.ac.nz!ARaman
From: ARaman@massey.ac.nz (Anand Venkata Raman)
Newsgroups: comp.unix.shell,comp.unix.questions
Subject: How to sort on exactly one field only
Message-ID: <1094@massey.ac.nz>
Date: 23 Oct 90 21:21:04 GMT
Reply-To: ARaman@massey.ac.nz (Anand Venkata Raman)
Organization: Massey University, Palmerston North, New Zealand
Lines: 27