cat filename | perl -ne '/\$mail_cmd/||print' # or perl -ne '/\$mail_cmd/||print' filename