Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[?] sort

Status
Not open for further replies.

shyg

Technical User
Jul 12, 2004
20
0
0
US
How can I sort a file by a specific word?
Code:
sort -dg "word2sort for" /etc/file >> test
 
What do you mean by sort a file by a specific word ?
Can you please post example of input and expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
This code returns an error:
Code:
sort -dg "word2sort for" /etc/file >> test

But if I were to sort the contents of "file" as so
Code:
sort -dg /etc/file >> test[\code]
There would be no problem.

[b]My goal is to sort "file" only returning the lines containing the text which I am after.[/b]

So as an example I used the useless code [code]sort -dg "word2sort for" /etc/file >> test
As my method to sort for the text "word2sort for". I hope that clears up my intent some what better.
 
man grep

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top