I have a few files in a directory and subdirectories that look like the following:
hello END OF DOCUMENT
goodbye END OF DOCUMENT 123
I want to remove “END OF DOCUMENT” and everything underneath that line. I want the file names and locations to remain the same, but I want the content changed.
So far, I have the following code:
for filename in /dir/**/*(.); do sed -n '/END OF DOCUMENT/q;p' -i "$filename"; done
This seems to be deleting content in the file, though. Any help woulld be appreciated!