Artificial intelligent assistant

How to merge 2 columns in a file alternatively? How to merge 2 columns in a file alternatively? See below example. inputfile: sam jam tommy bond expected_output: sam jam tommy bond

Simply with **`awk`** :


awk '{ print $1 ORS $2 }' file


* `$1` and `$2` \- are the 1st and 2nd field respectively
* `ORS` \- Output Record Separator. The initial value of `ORS` is the string "`\
`" (i.e., a newline character)



* * *

The output:


sam
jam
tommy
bond

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy bc4d48991235468f250695e8b539a2e2