grep to ignore patterns

I'm not fully following your example + the description but it sounds like what you want is this:

$ grep -v "<a href=.*title=.*NOTNEEDED" sample.txt 
<a href="http://website1.com" title="something">
<a href="http://website1.com" information="something" title="something">
<a href="http://website2.com" title="some_other_thing">
<a href="http://website2.com" information="something" title="something">

So for your example:

$ curl www.example.com | grep -v "<a href=.*title=" | grep -v NOTNEEDED > new.txt

The grep man page says:

-v, --invert-match
    Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX .) 

You can use regular expressions for multiple inversions:

grep -v 'red\|green\|blue'

or

grep -v red | grep -v green | grep -v blue

Tags:

Grep