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
1
  • A similar question is answered here, but with focus on shell processing.
    – Thor
    Aug 29, 2014 at 9:04

1 Answer 1

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .