1

I want to create a new file by copying rows of each file and pasting columnwise according to their file name orders. Here is the sample input and required output files below.

file1.txt

1234
5678
9201140

file2.txt

abcged
ghigk
lmn

required output file

out.tx

1234
abcged
5678
ghigk
9201140
lmn
cuonglm
  • 153,898
AiB
  • 787

1 Answers1

4

Simply paste:

paste -d'\n' file1.txt file2.txt

If you want to use awk, you can:

awk '{getline a < "file2.txt";printf "%s\n%s\n", $0, a}' file1.txt
cuonglm
  • 153,898