Jump to content

Bash: find command search several phrasses in one file


Recommended Posts

Guest postcd
Posted

Quote:

declare -a phrasses

phrasses[0]="phrasse 1"

phrasses[1]="phrasse 2 something'something\"something\" https://www.domain.com/');"

phrasses[2]="phrasse 3"

 

wheretosearch=/home

outputfile=/tmp/find_malicious_output.txt

 

for (( i=0;i<${#phrasses[*]};i++ )); do

phrasse=${phrasses[$i]}

echo "$phrasse"

find $wheretosearch -type f -size -800k -mmin -1440 -exec grep -l "$phrasse" {} \; >> $outputfile

Please how can i make this to search one file only once and all phrasses in it?

I mean i have around 30 phrasses and i dont want to do search 30 times, but only 1 time and search in file, you know to save io resources and time

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...