Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想合并 - 或至少区分 - 两个 Fortran 名称列表文件,同时忽略空格。和以 . 开头的行!。
!
我试过了
diff -w -u -I '!.*' FILE1 FILE2 diff -w -u -I '\!.*' FILE1 FILE2 meld FILE1 FILE2
但没有 regex-fu 似乎无法忽略!
使用 时-I,diff仅跳过每个更改的行与正则表达式匹配的大块。因此,您需要提前过滤掉这些行。
-I
diff
假设您使用的是 shell bash,您可以使用进程替换:
bash
diff -w -u <(grep -v '^!' FILE1) <(grep -v '^!' FILE2)
请注意,这可能会更改报告的行号和统一的输出。