sort broken?
Dear all,
something appears to have happened to sort I have a file called "junk" with a whole lot of lines like this: "N_A3F97.B99990010.pdb:REMARK 1 MODELLER OBJECTIVE FUNCTION: 1534.3015" in a bash shell I try: sort +5 -nr junk OR sort -nr +5 junk OR grep OBJECTIVE junk | sort -nr +5 I get: sort: open failed: +5: No such file or directory if I skip the "+5" it works fine but of course does not sort on the field I want it to help jenc |
You can't make up options to commands; you are limited to the options as described in the man pages (or info pages). I don't see any option to pass agruments as signed numbers.
Try something like this: cat junk | grep 'OBJECTIVE' | sort -nr You could also use awk to read the file and select based on the content of specified field. cat junk | awk '{print $5}' | sort -nr, or awk '{print $5}' junk | sort -nr or something along those lines. |
"in a bash shell I try:
sort +5 -nr junk OR sort -nr +5 junk OR grep OBJECTIVE junk | sort -nr +5" How about something like this? sort --key=5 -n junk Read the man pages again and give it another try. |
What I don't understand is why one would want to sort a column
with the word "function" numerically... Cheers, Tink |
Hi, Jenc.
You appear to be trying to use the old calling sequence for sort. For example, from the man page of Solaris 8 sort: Quote:
However, you will likely need to use the new calling sequence: Quote:
|
sort sorted
Thanks to all who replied esp mayo and Quakeboy02 who pointed out my real problem and reminded me to pay more careful attention to what is in the man page. using the updated version of the options worked a treat. I had been using the old way for years but hadn't used it for several months. now I will have to go and update all my scripts.
Ta very much jenc |
All times are GMT -5. The time now is 11:07 PM. |