Input file:
10 TMP_12 asdg
13 TMP_12 asdg
123 TMP_12 pasf
123 ASD qwe
224 AW4 asrfwe
524 AW4 2342
724 AW4 poimv
241 AW4 oiljs
.
.
Desired output file:
10 TMP_12 asdg
13 TMP_12 asdg
123 ASD qwe
224 AW4 asrfwe
.
.
Generate desired output file by following criteria:
- If column 2 data between two consecutive row are different, print whatever it is;
- If column 2 are same but column 3 are different between two consecutive row, print the first record find in particular column 2 data;
- If column 2 and column 3 data are exactly the same between two consecutive row, print it out everything in those particular record;
Below is the command I try:
awk '!_[$2]++' infe
10 TMP_12 asdg
123 ASD qwe
224 AW4 asrfwe
Above command can't really handle when face criteria 3 as stated above
Thanks for any advice