I have one file (.tsv) that contain variants calling for all the samples. I would like to merge the first three columns into one column:
Example: Original:
file name= variants.tsv > the first three columns that I want to merge are:
lane sampleID Barcode
B31 00-00-NNA-0000 0000
Desired output:
ID
B31_00-00-NNA-0000_0000
what are the recommended methods?
One way, with a perl one-liner:
Splits each line into an array (
@F
) on tabs, and prints out the header and later lines using slices of that array to extract the appropriate elements, which are then joined into delimited strings.