Artificial intelligent assistant

How to delete lines containing some names in one column in txt files I have some large tab-delimited text files look like: #CHR POS REF ALT EFC GOM 1 100 A G u_v(XXXXXX);i_v(XXXXXXX) 0 2 465 T C d_r(XXXXXX);i_r(XXXXXXXX) 1 9 600 T G d_i(XXXXXX);f_v(XXXXXXXX) - I want to delete the lines which (1) the content in "EFC" column contains "i_r" or "u_v" (even there are also "(XXXXXX)" and other things there) or (2) the values in "GOM" column equal to 1. So how to get the expected files using awk or sed?

Directly translated into awk:


awk -F'\t' '!($5 ~ /i_r/ || $5 ~ /u_v/ || $6 == 1) { print; }' input


1. Set the field separator to tab `\t`
2. If the following conditions are _not_ true `!( ... )`
3. Condition one: field 5 contains `i_r`, or
4. Condition two: field 5 contains `u_v`, or
5. Condition three: field 6 is `1`, then
6. `print` the line



Lines that match any of the conditions will not be printed ("deleted").

Sample output:


#CHR POS REF ALT EFC GOM
9 600 T G d_i(XXXXXX);f_v(XXXXXXXX) -

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ac95ef5a543567ee96758424b1ef3e6d