sed output file code example
Example 1: sed output to file
sed 's/Hello/Hi/g' file-name > file
Example 2: sed output of command
Just use something like following with p option at sed command`s end:
cat file.txt| sed -En "s/string_to_replace/replacement_string/p"
Example 3: gsed comand store file
sed -i 's/Hello/Hi/g' file-name