sed

Chester Wyke January 27, 2024 Updated: April 15, 2025 #debian

Source: https://www.linux.org/threads/why-i-love-sed-and-a-clear-practical-beginners-guide-to-using-it.43651/

Excerpt from man page

Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed’s ability to filter text in a pipeline which particularly distinguishes it from other types of editors.

Things to keep in mind

Examples

Simple word replace

sed -i 's/original_word/replacement_word/g' source_file.txt