1
i have a csv file which i need to filter mails marked with the word 'spam' lines look like this
email;text;somestatus;mailserver status response; response message
some@mail.com;mx.mail.com;2;connection reset; try later
thisspamshouldmatch@mail.com;somemx.record.com;3;spam message response; connection reset
thisshouldnotmatch@somedomain.net;spammxrecord.com;5;Deferred: lsjdflsdj; try later
shouldmatchspam@too.de;mx-too.de., dsn=4.0.0, stat=Deferred: Connection reset by mx-too.de.;4;Deferred: Connection reset by mx-too.de.
lines 3 and 5 should match
the pattern should match if in the first csv part (the chars until the first ';') contains the word 'spam' it shouldnt match if the word is within the other columns of the csv
i tried with
grep -e "spam[^;]*;\([^;]*;\)\{3\}"
anyone knows the solution? thx
seems working thx – John Doe – 2010-01-21T12:38:53.570