Appending text files
Hi I have a text file wherin I want to compare entries with respect to 1st and 4th column.
I want the record with the lowest start value and highest end value . |
So if you want all that, maybe you should show us what you've attempted to get it.
|
I tried this:
awk -F '[ |]*' ' { (($2 FS $5) in b) { b[$2 FS $5] = sprintf("| %s | %s | %s | %s | ", $2, $3, $4, $5) e[$2 FS $5] = sprintf(" | %s | %s |", $8, $9) m[$2 FS $5] = $6 M[$2 FS $5] = $7 next } {if($6 < m[$2 FS $5]) m[$2 FS $5] = $6 if($7 > M[$2 FS $5]) M[$2 FS $5] = $7 } END { for(i in b) printf("%s%s | %s%s\n", b[i], m[i], M[i], e[i]) }' inputfile > output |
Quote:
i would move move column 4 rite next to column 1 so you can scrape it like a key and grep/sed/awk against it and move it back later. |
All times are GMT -5. The time now is 04:45 PM. |