简体   繁体   English

如何从不同的文本文件中复制字符串以在单独的列中并排显示到 Bash 中的第三个文件中

[英]How to copy strings from different text files to show side by side, in separate columns, into a third file in Bash

Currently I have two txt files that have 200 lines of strings each.目前我有两个 txt 文件,每个文件有 200 行字符串。 The second file is an updated version of the first, so I want to combine them in Bash into a third file, where each line shows first the original file's string, and then the updated file's string in a separate column.第二个文件是第一个文件的更新版本,所以我想在 Bash 中将它们组合成第三个文件,其中每一行首先显示原始文件的字符串,然后在单独的列中显示更新文件的字符串。 So it would be 200 lines of strings, with each line showing the original and updated versions in separate columns side by side.所以它将是 200 行字符串,每行并排显示在不同列中的原始版本和更新版本。 Is this possible?这可能吗?

Use paste like this像这样使用粘贴

paste file1 file2

From man pasteman paste

Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output.将包含来自每个 FILE 的按顺序对应的行(由 TAB 分隔)组成的行写入标准输出。

Use Spreadsheets.使用电子表格。 It did the trick for me.它对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM