I would like grab one line (1 term) at a time from file1.txt and search sFile.txt... outputting all the lines that have the found term in it. file1.txt (300 lines) sFile.txt (100k lines) . I would like to use a command line (linux) fgrep
, ack
, find
, etc. I have tried a fgrep command but I am hitting the character limit so nothing is being processed.
tried: fgrep -wi 'front1' test.log >> final.txt
this worked but when adding file1.txt
the process was not able to run
file1.txt structure (case insensitive)
front1
front2
FrOnT3
sFile.txt structure
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front1/sharp_bootstrap/default/css"
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front3/sharp_bootstrap/default/css"
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front2/sharp_bootstrap/default/css"
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front0/sharp_bootstrap/default/css"
final.txt three lines should have been found
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front1/sharp_bootstrap/default/css"
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front3/sharp_bootstrap/default/css"
106.4 - - [12/Aug/2020:10:46:57 -0400] "GET /skin/front2/sharp_bootstrap/default/css"
稍微修改@thanasisp 所说的,如果您使用以下内容,您是否没有获得所需的输出?
grep -if file1.txt sFile.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.