Using a dictionary file with sed

Posted by Winston on Stack Overflow See other posts from Stack Overflow or by Winston
Published on 2010-03-11T03:20:01Z Indexed on 2010/03/11 5:33 UTC
Read the original article Hit count: 353

Filed under:
|

I have a blacklist.txt file that contains keywords I want to remove using sed.

Here's what the blacklist.txt file contain

winston@linux ] $ cat blacklist.txt   
obscure
keywords
here
...

And here's what I have so far, but currently doesn't work.

  blacklist=$(cat blacklist.txt);
  output="filtered_file.txt"

  for i in $blacklist;
    do
      cat $input | sed 's/$i//g' >> $output
    done

© Stack Overflow or respective owner

Related posts about bash

Related posts about sed