• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1579
  • Last Modified:

Sort Tab Delimited file in UNIX

Hello All,

I have 2 tab delimited files one with 16 and second with 5 million records with 40 columns. My requirement is to concatinate both the files resulting 21 million  and sort on the column numbers (5,10 and 1). I was able to use the cat command to concatinate but not able to sort on the specific fileds. I was able to sort the fixed width files but never tried the tab delimited.

Hope I will be helped with some solutions.

thanks
0
cutie_smily
Asked:
cutie_smily
  • 3
1 Solution
 
TintinCommented:
sort +4 +9 +1 file1 file2 >sortedfile

0
 
TintinCommented:
Correction

sort -k5,5 -k10,10 -k1,1  file1 file2 >sortedfile

0
 
cutie_smilyAuthor Commented:
Thanks for the reply it worked perfectly well. I am little curious here how do we sor the files if we have a delimiter like comma.

thanks
0
 
TintinCommented:
This is all in the man page.

-t,

0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now