I have a bunch of files that contain a semi-standard header. That is, its appearance is very similar, but the text changes somewhat.
I want to remove this header from all files.
From looking at the files, I know that what I want to delete is encapsulated between similar words.
So, for example, I have:
Foo bar...some text here...
more text
Foo bar...I want to keep everything after this point
I tried this command in perl:
perl -pi -e "s/\A.*?Foo.bar*?Foo.bar//simxg" 00ws110.txt
But that will not work. I am not a regular expression expert, but I hope someone knows how to basically remove a piece of text from the very beginning of the file based on text match rather than the number of characters ...
source
share