文件#1:
I have foofoo
You have foobar
she/he has foo
文件#2:
bar
foobar
barfoo
最终的:
I have foofoobar
You have foobarfoobar
she/he has foobarfoo
答案1
答案2
cuonglm 显然有最好的答案。两种选择:
shell (
bash
,zsh
,ksh
变体,mksh
)while read -u3 a; read -u4 b; do echo "$a$b"; done 3<file1 4<file2 > result
awk
awk '{a[FNR] = a[FNR] $0};END {for (i=1; i<=FNR; i++) print a[i]}' file1 file2 > result