Use regex in awk command in bash script

Posted by fmpdmb on Stack Overflow See other posts from Stack Overflow or by fmpdmb
Published on 2010-03-22T14:56:23Z Indexed on 2010/03/22 15:11 UTC
Read the original article Hit count: 570

Filed under:
|
|

I'm trying to read a file of regexes, looping over them and filtering them out of another file. I'm so close, but I'm having issues with my $regex var substitution I believe.

while read regex
do
  awk -vRS= '!/$regex/' ORS="\n\n" $tempOne > $tempTwo
  mv $tempTwo $tempOne
done < $filterFile

$tempOne and $tempTwo are temporary files. $filterFile is the file containing the regexes.

© Stack Overflow or respective owner

Related posts about bash

Related posts about awk