Here are a couple of sed tricks that I needed recently
Use sed to remove/delete all Leading/Trailing whitespace from each line (link)
To remove all whitespace (including tabs) from left to first word, enter:
echo " This is a test" | sed -e 's/^[ \t]*//'
To delete trailing whitespace from end of each line, enter:
$ cat input.txt | sed 's/[ \t]*$//' > output.txt
How to get everything in a file AFTER matching a text string (link)
The following will print the line matching TERMINATE till the end of the file:
$ sed -n -e '/TERMINATE/,$p'