Artificial intelligent assistant

AWK: Print first field of every line as identifier for every following field in the corresponding line I have a input file like this with a blank as field seperator AAABBB: 243.234.12.2 123.3.2 231.5.12 451.192.29.9 BBXDS: 324.22.32.5 235.235.283 234.239. 234.23.23.1 DDF: 23.12.59.09 98.39.239.29 394.293.2.2 The output should look like this: AAABBB: 243.234.12.2 AAABBB: 123.3.2 AAABBB: 231.5.12 AAABBB: 451.192.29.9 BBXDS: 324.22.32.5 BBXDS: 235.235.283 BBXDS: 234.239. ..... The first field of every line is a identifier and should be printed as a new line in front of every column in the corresponding line until the end of the line.

Fairly straightforwardly:


awk '{ for(i=2; i <= NF; i++) print $1, $i}' < input


On every line, loop from 2 until the last field (`N`umber of `F`ields), printing field 1 and the looped field.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 43c987726904b9e9c697be4eb03713af