1

Concatenate lines by first column (AWK or SED)

view story
linux-howto

http://unix.stackexchange.com – How can I use AWK in the following situation? I want to concatenate lines that start with the same column. Only the first column is kept after the join (in this case aaa, www, hhh). The file may be space- or tab-separated. Example input: aaa bbb ccc ddd NULL NULL NULL aaa NULL NULL NULL NULL NULL NULL aaa bbb ccc NULL NULL NULL NULL www yyy hhh NULL NULL NULL NULL hhh 111 333 yyy ooo hyy uuuioooy hhh 111 333 yyy ooo hyy NULL Desired output: aaa bbb ccc ddd NULL NULL NULL NULL NULL NULL NULL NULL NULL bbb ccc NULL NULL NULL NULL www yyy hhh NULL NULL NULL NULL hhh 111 333 yyy ooo hyy uuu (HowTos)