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\" >
Pure bash:
liori@marvin:~$ zip34() { while read word3 <&3; do read word4 <&4 ; echo $word3 $word4 ; done }
liori@marvin:~$ zip34 3
(old answer) Look at join
.
liori:~% cat a
alpha
beta
gamma
delta
epsilon
liori:~% cat b
one
two
three
four
five
liori:~% join =(cat -n a) =(cat -n b)
1 alpha one
2 beta two
3 gamma three
4 delta four
5 epsilon five
(assuming you've got the =() operator like in zsh, otherwise it's more complicated).