sed Command Tester
Run a sed script on sample text in your browser: s/// substitutions with groups and flags, deletes, prints, line ranges, y/// and basic or extended regex.
Free · No sign-up · Your inputs stay in your browser
Input
Test a sed command
Output
Output
59 characters
Equivalent command: sed 's/\(DB_HOST\)=.*/\1=10.0.0.5/; /^#/d; s/debug/info/g' file. Without -E, sed uses basic regex: \( \) groups and \{n\} counts, and a bare + or ? is literal in POSIX (GNU sed accepts \+ and \?). In-place editing differs: GNU sed -i, but macOS sed -i '' with an empty suffix.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Basic versus extended regex
Without -E, sed uses POSIX basic regular expressions: groups are written with backslashed parentheses and counts with backslashed braces, and + and ? are literal (GNU sed accepts backslashed versions as extensions). With -E they behave as in most other tools. Mixing the two up is the usual reason a substitution does nothing. The GNU sed manual covers both.
In-place editing differs by platform
GNU sed takes sed -i 's/a/b/' file; BSD and macOS sed require a backup suffix argument, empty for none: sed -i '' 's/a/b/' file. Scripts meant for both write a backup suffix such as -i.bak, which both accept.