similar to question 'Remove entire row only if every column within it is either $VAR1 or $VAR2'
BUT its to remove an entire COLUMN instead, and is based on the make up of every ROW in the column
I have a text file where column and row number will always vary, and want to remove the entirety of any columns from the txt file only if every row within said column is equal to either $VAR1 or $VAR2. For example:
Lets say $VAR1="X" and $VAR2="N" and I want to remove any column where $VAR1 and $VAR2 makes up the entire column.
This would be my input:
hajn 32 ahnnd namm X 543 asfn F
namd 90 jsnfu namm X 098 asfn S
5739 dw 32eff Sfff N asd 3123 1
And this would be my desired output:
hajn 32 ahnnd namm 543 asfn F
namd 90 jsnfu namm 098 asfn S
5739 dw 32eff Sfff asd 3123 1
I can solve this with a loop, but I was wondering if there's a powerful one liner way of doing this, preferably awk.