sed
Program: sed
Edits text line by line with a script.
Usage
sed [OPTION]... SCRIPT [FILE]...
Description
Run the editing SCRIPT on every line of the FILEs (or of the keyboard or pipe) and print the result. Without -e or -f the first argument is the SCRIPT. Commands: s/RE/TEXT/ replaces, d deletes, p prints, a, i and c add or change lines, y changes characters, h, H, g, G and x use the hold space, n and N read the next line, q quits.
Options in the simulator
6 more options of the real program, not in the simulator yet
Examples
cat env.conf
API_HOST=staging.example.com
PATHS=/srv/staging:/opt/staging
DEBUG=true
sed 's/staging/production/' env.conf
API_HOST=production.example.com
PATHS=/srv/production:/opt/staging
DEBUG=true
sed 's/staging/production/g' env.conf
API_HOST=production.example.com
PATHS=/srv/production:/opt/production
DEBUG=true Where you learn it
Lessons
- Changing text with sed Linux Basics, Module 3: Text tools