How can I write in nth column of a file in awk?

后端 未结 4 1959
醉梦人生
醉梦人生 2021-01-16 11:02

For example:

abc
xyz
123
546

input.txt:

asdad
asdad
adghf
dfytr

I wanted to add the above column in 2nd c

4条回答
  •  爱一瞬间的悲伤
    2021-01-16 11:38

    In awk:

    awk 'NR==FNR {x[NR] = $0} NR != FNR {print x[FNR], $0}' col1_file col2_file
    

    Though its probably better to use paste

提交回复
热议问题