0

Following suggestions from this answer I'm using the following line in a script to read a mbox file format and do some operations non relevant to the question.

awk "/^Subject\: $GOODSUBJECT$/{a=1}/^From\:\ $GOODSENDER /{print;a=0}a" $MBOX

How would I delete all the lines selected by this match after my script has done its job?

Please note that they might not be deleted one by one by matching them, like I could do with sed, because - for instance - if I'll match a whitespace all lines with withespaces would be deleted in all mails.

I want to delete just the lines delimited by this awk selection instead.

Is it possible?

1

Just do reverse match to keep those that doesn't match with:

awk "!/^Subject\: $GOODSUBJECT$/{a=1} !/^From\:\ $GOODSENDER /{print;a=0}a" $MBOX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.