Sed Command Generator
Builds sed commands for substitution, deletion, printing, and inserts, with a live preview.
Paste a sed command to check its syntax and read what each part does in plain English. Unterminated substitutions, unknown commands, bad flags, and unbalanced braces are caught before you run it.
sed -n '/start/,/end/p' log.txt, or only the script.-n, -e, -f, -i with or without a suffix, -E and -r, -s, and -z.; and line breaks. Each command's address is parsed: line numbers, $, /regex/, ranges, first~step, and ! negation.s and y must have all three delimiters. The flags of s must be from g, p, i/I, m/M, e, w file, or a number, and y needs source and target of equal length.{ needs a matching }. Patterns are test-compiled to catch unbalanced brackets and groups.sed 's/foo/bar' file: error, the s command is missing its closing delimiter. Write s/foo/bar/.sed 's/a/b/x' file: error, x is not a valid flag for s.sed '/start/,/end/{s/old/new/g' file: error, the { is never closed.sed -i 's/\bcat\b/dog/g' notes.txt: valid on GNU sed, with a warning that \b and -i without a suffix don't work on macOS.sed -n '/^#/!p' config: valid. Explanation: don't print lines automatically; for every line that does not start with #, print it.-i.-f script.sed can't be read. Paste the script's contents instead.$HOME inside double quotes are not expanded.The s command needs three delimiters: s/find/replace/. It usually means the final slash is missing, or the text contains an unescaped /. Use another delimiter such as s|a/b|c|.
Linux uses GNU sed. macOS and FreeBSD use BSD sed, which needs a suffix after -i, has no I flag, and doesn't support \b, \+, or one-line a text. The validator marks GNU-only features.
Yes. If the input doesn't start with sed, it is treated as the script itself.
No. It is checked in your browser.
Often used together with the Sed Command Validator.
Builds sed commands for substitution, deletion, printing, and inserts, with a live preview.
Highlights regex matches live, lists capture groups and offsets, and previews replacements.
Checks .htaccess files for unknown directives, unclosed blocks, and bad rewrite rules.