Is there similar Python zip() functionailty in bash? To be specific, I\'m looking for the equivilent functionality in bash without using python:
$ echo \"A\" >
You could do it in two steps with cat -n
followed by join
. (cat -n
reproduces your file with line numbers at the start of each line. join
joins the two files on the line numbers.)
$ echo "A" > test_a
$ echo "B" >> test_a
$ echo "X" > test_b
$ echo "Y" >> test_b
$ cat -n test_a > test_a.numbered
$ cat -n test_b > test_b.numbered
$ join -o 1.2 -o 2.2 test_a.numbered test_b.numbered
A X
B Y