Checkout easy to understand sed examples to do find and replace string from input, find and replace in a file, append to a file, remove empty lines from file, find and replace between specific lines etc.
Source: LXer – Sed Find And Replace With Examples