-1

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
  • 5,855
  • 3
  • 14
  • 31
acctman
  • 4,229
  • 30
  • 98
  • 142

2 Answers2

0

Slightly modifying what @thanasisp said, are you not getting the desired output if you use the below?

grep -if file1.txt sFile.txt
SSS
  • 51
  • 6
0

I found the solution... Source for Solution

fgrep -v -F -f file1.txt sFile.txt
acctman
  • 4,229
  • 30
  • 98
  • 142