Search Results

Search: Posts Made By: richa_240889
1,180
Posted By MadeInGermany
cat -n starts from 1 with each file, so awk with...
cat -n starts from 1 with each file, so awk with its NR is better:
awk '{print (NR "\t" $0)}' input1.txt input2.txt ... | sort -k2,2 -k4,4 -k1,1 | cut -f2-Note: the awk inserts a tab-separated field...
1,180
Posted By MadeInGermany
If you want 12 output files you need to treat...
If you want 12 output files you need to treat them separately, and a loop is appropriate.
for file in input1.txt input2.txt ...
do
cat -n "$file" | sort -k2,2 -k4,4 -k1,1 | cut -f2- >...
1,180
Posted By RudiC
The result you get is exactly as specified -...
The result you get is exactly as specified - sorted by field 1 (all lines identical), then field 3. I don't see column 2 sorted - it's just random, as its results are unspecified. To keep the...
1,180
Posted By Corona688
I dealt with something like this before. I had...
I dealt with something like this before. I had to add an extra column, which held the line number, like:

1 101 100 1
1 001 200 2
1 002 100 3

...so that I could give that column number to...
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 11:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy