【发布时间】:2022-01-11 21:14:04
【问题描述】:
我有2 文件File1, and File2。 File1 是strings、line1 contain string1、line2 contains strings2 and so on 的列表。我想从File1 中选择string1 并将其与File 2 进行比较。然后我选择string2 并将其与File2 进行比较。该脚本不知道File1 and Fil2 中有多少个字符串。一旦来自File1 are compared with File2, 的所有字符串,脚本应该给出一个alarm/pop up window,其中strings 列表与File2 匹配。
【问题讨论】:
-
您是否正在寻找 bash 中的解决方案?或任何编程语言。好吗?
-
satvik choudhary,是的 bash linux。你能指导我吗
-
它必须是
for循环(或任何循环)吗?因为您要的是一个集合交点,即File1和File2中的行。这可以使用单个grep或sort或其他几个来完成。 -
到目前为止你尝试了什么?
-
分而治之。从循环读取
File1开始,然后添加其他内容。
标签: linux string bash shell for-loop