档案1
dog
cat
spider
donkey
文件2
Bone
Mushroom
bug
grass
需要输出
档案3
dog Bone
cat Mushroom
spider bug
donkey grass
答案 0 :(得分:2)
合并文件行的正确工具是paste
paste file1 file2 > file3
输出:
dog Bone
cat Mushroom
spider bug
donkey grass
答案 1 :(得分:1)
通过awk,
awk 'FNR==NR{a[FNR]=$0;next}{print a[FNR],$0}' file1 file2 | column -t > file3
示例:
$ awk 'FNR==NR{a[FNR]=$0;next}{print a[FNR],$0}' file1 file2 | column -t
dog Bone
cat Mushroom
spider bug
donkey grass