Interview Prep/Shell Scripting/Text processing: grep, sed, awk, cut, sort, uniq

What are the core `sed` commands you use in automation?

BeginnerConceptText processing: grep, sed, awk, cut, sort, uniq
Answer
sed 's/old/new/'            # first match per line
sed 's/old/new/g'           # all matches
sed -n '5,10p'              # print only lines 5-10
sed '/^#/d; /^$/d'          # delete comments and blank lines
sed -i.bak 's/^LogLevel .*/LogLevel INFO/' app.conf   # edit in place, keep backup
sed -E 's/([0-9]+)ms/\1 ms/g'                         # ERE with capture group
sed '/\[mysqld\]/a max_connections = 500' my.cnf      # append after match (GNU)
sed 's|/var/www|/srv/www|g'                           # alternate delimiter for paths

sed is line-oriented: perfect for substitutions and filtering, awkward for multi-line or column logic (use awk).

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Text processing: grep, sed, awk, cut, sort, uniq