I have a TSV file with two columns in the format of
id1\tcol1,col2,col3
id2\tcol4,col5
I want to split the second column in combination with the first column to output
id1,col1
id1,col2
id1,col3
id2,col4
id2,col5
There are two problems:
- The number of comma-separated values in the second column of TSV is not fixed
- File is too big to be loaded into memory
The comma-separator values are clean without any ,. Thus no enclosing " is used. Therefore, we split at each and every comma.
awk -F'\t', but have no idea how to split the second column by,.splitfunction insideawkawkfoo bar\tcol name1,col name2would break if you don't set FS to a tab, for example. So far the OP has just told us none of the fields contain commas but there could be blanks anywhere as far as we know so far.