现在想根据一个文件中的id列表,找出在另一个文件含有该id的相应行,假设有文件a.txt和b.txt,内容如下:
a.txt
--------------------------------------------------
a 1 2
b 3 4
c 4
d 4 5 5
---------------------------
b.txt
------------------------------------------------------
a
c
--------------------------------------------------------------
执行命令grep -Ff b.txt a.txt 轻松搞定
have fun!
a.txt
--------------------------------------------------
a 1 2
b 3 4
c 4
d 4 5 5
---------------------------
b.txt
------------------------------------------------------
a
c
--------------------------------------------------------------
执行命令grep -Ff b.txt a.txt 轻松搞定
have fun!
Powered by ScribeFire.
没有评论:
发表评论