10

Awk pattern with letters and forward slash

view full story
linux-howto

http://www.unix.com – Hi, I have a tab delimited file "test.txt" like this: Code: id1 342 C/T id2 7453 T/A/-/G/C id3 531 T/C id4 756 A/T/G id5 23 A/G id6 717 T/A/C id7 718 C/T/A And so on, with the possible choices for letters being A,C,T,G. I would like to exclude from my file all the lines that do not have exactly any of the letters split by forward slash, followed by any of the letters. So I would like my file to look like this: Code: id1 342 C/T id3 531 T/C id5 23 A/G I have not been able to find a good regex for this. I have tried: Code: awk '{  if($3 !='/([ACTG]\)/([ACTG]/)' (HowTos)