简体   繁体   English

匹配文件1和文件2中的数据范围

[英]match data range from file1 with file2

I have two files, namely file1.txt and file2.txt which contain data as follows: 我有两个文件,分别为file1.txt和file2.txt,其中包含如下数据:

file1.txt file1.txt

953503-955502
1284493-1286492
2158134-2160133
2564482-2566481
2983742-2985741
4713105-4715104
6259680-6261679
....

file2.txt file2.txt

245201276-245202076
245201286-245202086
245201302-245202102
245201323-245202123
245201338-245202138
245201344-245202144
....

Both files have more than 3000 data. 这两个文件都有3000多个数据。

In this set, I want to match from the range of data from file1.txt within the range of data from file2.txt and get the output in a new file. 在此集合中,我想从file1.txt的数据范围内匹配file2.txt的数据范围,并在新文件中获取输出。

How can I match the range of data from the files. 如何匹配文件中的数据范围。 Please give me some suggestions. 请给我一些建议。 Thanks in advance for your kind help! 在此先感谢您的帮助!

Use diff, its a build in linux command. 使用diff,它是在linux命令中构建的。 Very smart 很聪明

暂无
暂无

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

相关问题 Perl 打印匹配且无匹配字符串来自 file1 匹配 file2 匹配百万记录 - Perl print match and no match strings from file1 match in file2 match with million records Perl 使用 file2 从 file1 中删除单词 - Perl removing words from file1 with file2 Perl 在屏幕或 File3 中从 file1 和 file2 打印匹配和不匹配的字符串 - Perl Print matched and unmatched String from file1 and file2 in screen or File3 如何循环匹配文件 1 的第 1 列和第 2 列与文件 2 的第 1 列中的单元格,以便将它们替换为文件 2 的第 2 列中的相邻单元格? - How do you loop and match column 1 and 2 of file1 with cell in column1 of file2 in order to replace them with the adjacent cell in column 2 of file 2? tail -f file1 | perl -pe'$ _'> file2不向file2输出任何内容 - tail -f file1 | perl -pe '$_' > file2 does not output anything to file2 如果file1的第一列与file2中的任何字符串匹配,则将其替换为file1的第二列 - If the first column of file1 matches any string in file2, then replace it with the second column of file1 需要用file1的第二列替换与file1的第一列匹配的file2中的字符串 - Need to replace string in file2 that matches first column of file1 with second column of file1 在Perl中获取file2中没有出现的所有行的最快方法是什么? - What's the fastest way in Perl to get all lines of file1 that do not appear in file2? 从两个文件读取并从文件1打印line1 +从文件2打印所有行,然后对文件1中的所有行进行打印 - Read from two files and print line1 from file 1 + all lines from file2 and do that for all lines in file 1 如何匹配两个.csv文件并写入第三个文件,用文件1中的数据替换文件2中的数据 - How to match two .csv files and write on third file replacing data in file 2 with data from file 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM