Stream editor for filtering and transforming text.
sed processes text line-by-line, applying editing commands such as substitution, deletion, and insertion. It is widely used for quick text transformations in pipelines and scripts.
# Replace text sed 's/foo/bar/' file.txt # Replace globally sed 's/foo/bar/g' file.txt
# Delete lines containing a pattern sed '/error/d' logfile # Print only matching lines sed -n '/error/p' logfile # In-place edit (GNU sed) sed -i 's/old/new/g' file.txt # Replace first occurrence per line sed 's/foo/bar/' file.txt