nun*_*nos 0 unix shell awk grep sed
我有一个大文本文件,我想从中删除另一个文本文件中的一些行.似乎sed
Unix shell 中的命令是一个很好的方法.但是,我无法弄清楚要使用哪些标志..
database.txt:
this is line 1
this is line 2
this is line 3
this is line 4
this is line 5
Run Code Online (Sandbox Code Playgroud)
lines_to_remove.txt
this is line 1
this is line 3
Run Code Online (Sandbox Code Playgroud)
what_i_want.txt
this is line 2
this is line 4
this is line 5
Run Code Online (Sandbox Code Playgroud)
grep
比sed
这个更适合:
grep -Fxv -f lines_to_remove.txt database.txt > what_i_really_really_want.txt
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
239 次 |
最近记录: |