开发者

Comparing two files using awk or sed

I ha开发者_Go百科ve two files...

Lookup is 1285 lines long:

cat Lookup.txt 
abc
def
ghi
jkl

main is 4,838,869 lines long:

cat main.txt
abc, USA
pqr, UK
xyz, SA

I need to compare lookup and main and then output the matching lines in main to final.txt


You don't need awk or sed here but grep, assuming I am reading your requirements correctly:

% grep -f lookup.txt main.txt > final.txt
% cat final.txt 
abc, USA
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜