I'd like to do something similar to sed
in Perl, namely be able to delete lines matching a certain pattern.
Given this input:
abcd
edfd
abcd
derder
abcd
erre
I want to remove the lines containing bc
. How can I do this?
I had to use double quotes on Windows:
perl -ne "print unless /bc/" file
This is a FAQ.
How do I change, delete, or insert a line in a file, or append to the beginning of a file?
If you're programming in Perl then it's well worth taking a couple of hours to familiarise yourself with the FAQ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With