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 file based on certain criteria in line 1

Status
Not open for further replies.

sco1104

IS-IT--Management
Feb 5, 2001
9
US
I have a problem with sort and uniq commands

I have a large file with the following format

06-02-2005 00:01:16|INFO |06-02-2005|00:02:06|481780134|0x49|N|010101010101010101010101010

I need to sort and remove duplicate lines based on the second date and time stamp (after INFO), the series of numbers and the hex code (0x49) only.

I have tried
sort -t, -u -k27,55 "filename" > "output filname"

but I am not getting the results expected. Would anyone have any ideas on how this can be performed?? Your help is appreciated. Thank you..
 
sort -t '|' -u -k4,6 "filename" > "output filname"

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
sort -u -t'|' -k 3.7 -k 3,6 "filename" > "output filname"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the help. The output file is just what I need.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top