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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SORT command

Status
Not open for further replies.

dvknn

IS-IT--Management
Mar 11, 2003
94
US
Hi, I have a file like this (I already soretd this based on 1st column). How can I sort this file by column 1 and then column 2?

2003.06.04|galvanometer|ALL WORDS
2003.06.04|jerkin|ALL WORDS
2003.06.04|woolen|ALL WORDS
2003.06.05|UStoBEdavidtest|ALL WORDS
2003.06.09|TENNISBALL|ALL WORDS
2003.06.09|dryfruits|ALL WORDS
2003.06.10|freon|ALL WORDS
2003.06.11|headsets|ALL WORDS

thanks,
 
Try something like this:
Code:
sort -t'|' -k 1,1 -k 2,2 <input >output
or this:
Code:
sort -t'|' +0 -1 +1 -2 <input >output
Anyway: man sort

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top