I want to know if there is an easy way to split a line in a file into multiple lines, such as this:I haveA B C1 2 3 4And I want to get something like this, based on the first string of the line:A BA C1 21 31 4Basically based on the first string in the line create multiple lines with the second and third and fourth string and so on.
Split line into key-value pairs based on first string
text processing
Here goesawk '{for (i=2; i<=NF; ++i) print $1, $i}' fileA BA C1 21 31 4