I have a tab-delimited file like shown below, and would like to merge the rows based on matches in any of the columns. The number of columns are usually 2, but could vary in some cases and be 3.
input:
AMAZON NILE
ALASKA NILE
HELLO MY
MANGROVE AMAZON
MY NAME
IS NAME
desired output:
AMAZON NILE ALASKA MANGROVE
HELLO MY NAME IS
How could one go about this with awk?
Will this work for the below file also? input:
apple_bin2file strawberry_24files
mango2files strawberry_39files
apple_bin8file strawberry_39files
dastool_bin6files strawberry_40files
apple_bin6file strawberry_40files
orange_bin004file dastool_bin004files
orange_bin005file dastool_bin005files
apple_bin3file dastool_bin3files
apple_bin5file dastool_bin5files
apple_bin6file dastool_bin6files
apple_bin7file dastool_bin7files
apple_bin8file mango2files
expected output in tab-delimited format:
apple_bin2file strawberry_24files
mango2files strawberry_39files apple_bin8file
dastool_bin6files strawberry_40files apple_bin6file
orange_bin004file dastool_bin004files
orange_bin005file dastool_bin005files
apple_bin3file dastool_bin3files
apple_bin5file dastool_bin5files
apple_bin7file dastool_bin7files
Sorry to those who answered, I updated the input files!