> On Tue, Sep 20, 2011 at 08:58:34AM -0500, Dennis Williamson wrote:

>You can get as fancy as you want with regexes in order to catch all
>cases of "rm" anywhere on the line and reduce the chances of a false
>positive:
>
>gawk '{ c = $0; getline; if ($0 ~
>(^|;[[:space:]]*)\<rm\>[[:space:]]+/) { print c; print; } }'
>.bash_history
>
>might come a little closer, but it would falsely catch "echo 'There
>will be cake; rm 414 is reserved for the party'". It lets your
>"maildirmake" through.
>
>It searches for "rm" anywhere on the line as a "word" (and followed by
>at least one space or tab) at the beginning of the line or after a
>semicolon and optional spaces or tabs.


Well, I'm sure whomever needs to find this thread in the future is now going to
find a real gem of info!

(Started reading the GNU GAWK manual last night and now have a good jump start
on GAWK, along with incorporating regex.)

-- 
Roger
http://rogerx.freeshell.org/

Reply via email to