I need to modify all files that has a ".txt" extension within a directory in the following way:
remove all text lines beginning with the line that starts with "xxx" and the line that ends with "xxx", inclusive.
I know how to do this in Java or C++, but can someone show me a simple script that can get this done?
Thanks!
I assume that you want to lose start and end, and those words appear by themselves on the lines you want lost.
perl -ni.bak -e 'print unless /^start$/../^end$/' *.txt
Note that I made a backup of the modified files so that you can inspect the change and fix it if you want.
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