HI,
I have a file like this:
5_2207830114 5_2207830114,13_2207830312,15_2207830336
8_2207830145 8_2207830145,15_2207830336
10_2207830220 5_2207830114,7_2207830138,8_2207830145,10_2207830220,12_2207830244,13_2207830312,15_2207830336,16_2207830343
12_2207830244 12_2207830244,15_2207830336,16_2207830343
I want an output like this:
5_2207830114 13_2207830312,15_2207830336
8_2207830145 15_2207830336
10_2207830220 5_2207830114,7_2207830138,8_2207830145,12_2207830244,13_2207830312,15_2207830336,16_2207830343
12_2207830244 15_2207830336,16_2207830343
SO basically I want to remove the value of the first column in the second column.
I tried several commands with awk but didn'T get the desired output. Can anyone help?
Thanks
anbu23
2
Can you post what you tried?
I tried:
awk -F $'\t' '$1=/.*$2.*/ {print $0}' unique_matches.txt
but this does not result in anything...
and then I tried
awk -F $'\t' '$2=$1,/.*/ {print $0}' unique_matches.txt
but the output is:
5_2207830114 5_2207830114
8_2207830145 8_2207830145
10_2207830220 10_2207830220
12_2207830244 12_2207830244
so its somehow the opposite
RudiC
4
How about
awk '{sub ($1 ",", "", $2)} 1' file
5_2207830114 13_2207830312,15_2207830336
8_2207830145 15_2207830336
10_2207830220 5_2207830114,7_2207830138,8_2207830145,12_2207830244,13_2207830312,15_2207830336,16_22 07830343
12_2207830244 15_2207830336,16_2207830343
1 Like
Wow, thank you, that's perfect!...and actually so simple