I have a file as below:
name1 name2 name3 name4
AA BB BB CC
AA AA BB CC
AA CC BB CC
AA DD BB DD
AA DD BB AA
column 1 and column 3 have the same string within itself. I wish to remove the entire column if the case is as described above but keep the header. So eventually the file will become something like this.
name2 name4
BB CC
AA CC
CC CC
DD DD
DD AA
Is there any way to do so using grep or awk? Thanks a lot!