Tools
Sed
Filter and transform line-oriented text without changing the original file.
Substitute
sed 's/old/new/' file.txtReplace the first match on each linesed 's/old/new/g' file.txtReplace every match on each linesed -E 's/[[:space:]]+/ /g' file.txtCollapse whitespace using extended regexsed 's|/old/path|/new/path|g' file.txtUse a different delimiter for pathsSelect lines
sed -n '5,10p' file.txtPrint a line rangesed -n '/ERROR/p' app.logPrint matching linessed '1d' file.txtDrop the first line from outputsed '/^$/d' file.txtDrop empty lines from outputSafe file workflow
sed 's/old/new/g' file.txt > updated.txtWrite transformed content to a separate filediff -u file.txt updated.txtInspect the proposed changesed -n '$p' file.txtPrint the last linesed -n '1p' file.txtPrint the first line