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" > test_a
$ echo "B" >> test_a
$ echo "1" > test_b
$ echo "2" >> test_b
$ python -c "print '\n'.join([' '.join([a.strip(),b.strip()]) for a,b in zip(open('test_a'),open('test_b'))])"
A 1
B 2
Pure bash:
(old answer) Look at
join.(assuming you’ve got the
=()operator like inzsh, otherwise it’s more complicated).