合并两个文件 [英] merging two files
本文介绍了合并两个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个文件(制表符分隔)一个文件是有4列和n行的数量,第二个文件有2列和n行的数量。
I have two files (tab delimited) one file is has 4 columns and n number of rows and second file has 2 columns and n number of rows.
第一个文件的4列是相同的第二个文件的第2列。
column 4 of first file is identical to column 2 of second file.
我希望有第三个文件,其中包含从文件2从文件1和5列前四列。
I want to have a third file which contains first four columns from file 1 and column 5 from file 2.
一行bash脚本的任何建议。
Any suggestions for one line bash script.
推荐答案
尝试加入
加入文件1文件2 -1 4 -2 2 -t标签
要FILE1的前preSS基于第4场中的文件FILE1和file2之间的连接( -1 4
)和第二场( -2 2
)FILE2的
to express a join between the files FILE1 and FILE2 based on the 4th field (-1 4
) of FILE1 and the 2nd field (-2 2
) of FILE2
这篇关于合并两个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文