如何在Bash中逐行合并两个文件 [英] How to merge two files line by line in Bash

查看:111
本文介绍了如何在Bash中逐行合并两个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文本文件,每个文件都包含一行这样的信息

I have two text files, each of them contains an information by line such like that

file1.txt            file2.txt
----------           ---------
linef11              linef21
linef12              linef22
linef13              linef23
 .                    .
 .                    .
 .                    .

我想使用bash脚本逐行合并这些文件,以获得:

I would like to merge theses files lines by lines using a bash script in order to obtain:

fileresult.txt
--------------
linef11     linef21
linef12     linef22
linef13     linef23
 .           .
 .           .
 .           .

如何在Bash中完成此操作?

How can this be done in Bash?

推荐答案

您可以使用 paste :

You can use paste:

paste file1.txt file2.txt > fileresults.txt

这篇关于如何在Bash中逐行合并两个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆