I'd like to print line if column 5th doesn't match with exm. But to reach there I have to make sure I match single quote.
I'm struggling to match that.
I've input file like:
Warning: Variants 'exm480340' and '5:137534453:G:C' have the same position.
Warning: Variants 'exm480345' and '5:137536897:C:G' have the same position.
Warning: Variants 'exm2274094' and '5:137548976:G:C' have the same position.
Warning: Variants 'exm480367' and '5:137548988:G:A' have the same position.
Warning: Variants 'exm480373' and '5:137588691:G:A' have the same position.
Warning: Variants 'exm480383' and '5:137589456:G:A' have the same position.
Warning: Variants 'exm480395' and '5:137593337:G:A' have the same position.
Warning: Variants 'exm480405' and '5:137593620:A:G' have the same position.
Warning: Variants 'exm2087676' and '5:137599964:C:T' have the same position.
Warning: Variants 'exm480435' and '5:137621421:C:T' have the same position.
Warning: Variants 'exm2256415' and 'exm2067772' have the same position.
Code:
grep " have the same position." input.log | awk ' { if( $5 ~ /^\'/ ){print $0} } '
Error:
-bash: syntax error near unexpected token `)'
I tried with "'" too, but it failed.
How do I get around this error?
Edit: Sure, I'll use CODE for data.
I've added line for which I'm writing awk line.
grep " have the same position." input.log | awk -v re="^'exm" ' { if (! ( $5 ~ re )) print $0 }'
It's hard for me not use if and parentheses. I don't know how you folks easily swim around without if, and other syntax.
I added ! in if because I need only those lines that don't have 'exm in fifth column.