I have a large text file. I would like to delete all the lines of of text below a certain phrase. For instance in this text:
Once upon a time.
There were three little pigs. They grew up to be terrible craftsmen and in any event one or more of them died in obscurity.
I also have a story about foxes. Some foxes are faster than other foxes. Some foxes are hopeless romantics.
I would delete all the text below "Once upon a time".
I am using this as guidance How do I delete all lines in a file starting from after a matching line? and tried the following:
sed -i.bak '/Once upon a time/,$ d' /Users/auser/folder/folder/output.txt
But I end up with my entire text file being empty (vs. just the text below the match).
Also, I'm using a Mac.