Delete lines that match a pattern
Delete all comment lines that start with # directly in the file.
sed -i '/^#/d' config.conf
More linux commands
-
sed -n '/START/,/END/p' file.txtPrint the block of text from START to END, including the marker lines.
-
sort file.txt | uniq -c | sort -rnCount how many times each unique line appears, most frequent first.
-
who -H && wShow active user sessions and what each user is running.
-
last -n 20 | head -25Show the last 20 logins with IP and session length.
-
journalctl -u ssh --since '24h ago' | grep 'Failed password' | awk '{print $(NF-3)}' | sort | uniq -c | sort -rn | head -10Show the top 10 IPs with failed SSH password logins in the last 24 hours.