Bash: find command search several phrasses in one file

  • Thread starter Thread starter postcd
  • Start date Start date
P

postcd

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...
 
Back
Top