I have a file like this (delimited by ):
gene1 previous name1
gene2 previous name2
gene3 previous name3
gene4 previous name4
I want to delete the columns that contain gene2 and gene4 in the first column. I know that I can search multiple patterns using sed or awk and a | but in reality my file have thousand of lines and I want to delete hundred of columns (I have a variable with the patterns I want to search for). How can I do this without having to write manually all the patterns?
Pattern variable:
gene2
gene4
Expected output:
gene1 previous name1
gene3 previous name3
I only want to grep the first column because the word gene2 (or *gene4) could be in the third column.
question from:https://stackoverflow.com/questions/65890994/how-to-delete-multiple-columns-using-multiple-patterns