how to sort this .txt file
Hi, I have this .txt file
3183630 R 3574216 W 5264994 M 2656889 A I want to sort it by the numerical order of column. After sort, I wish to get output like 2656889 A 3183630 R 3574216 W 5264994 M anyone knows how to use sort to do that? or any other command? thanks a lot |
sort -n
man sort for details Cheers, Tink |
Hi, Tink
Thanks for your response. I used sort +0 -1 input.txt > output.txt but it can't sort the first column by numerical order... It seems treating the 1st column as characters. For example, after running my command, I got this 1001084 R 10011 R 10012 S 1003918 R 1004172 R 1005844 S 100707 S 1011598 R 1013262 R 1020374 W Do you know the right option I should use with sort? Thanks |
cliffyao, did you indeed read the entire Tinkster's post?
|
Have you tried what Tinkster suggested? sort -n forces numerical order.
Edit: repetita iuvant.. ;) |
oops, my bad..I thought "sort -n" is like sort the nth column, just like my "sort -1". Tink, sorry for misunderstanding your post.
I tried sort -n input.txt > output.txt and it is working. But, how about if my numbers are not in the first column? Thanks everbody. |
Quote:
|
All times are GMT -5. The time now is 08:18 PM. |