Section: sed and Stream Editing

Reformat date

bash
bash
sed -E 's/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/\2\/\3\/\1/'
Explanation

Uses capture groups and backreferences in the replacement.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sed and Stream Editing
Trim trailing spaces
Remove trailing whitespace from each line.
OpenIn sheetbashsame section
Prefix non-empty lines
Add a prefix only to non-empty lines.
OpenIn sheetbashsame section
Extract quoted content
Print only the content inside double quotes on each line.
OpenIn sheetbashsame section
sed regex replacement
Replace all runs of whitespace with a single space.
OpenIn sheetbash1 tag match
grep whole word
Find full-word matches in files.
Atomic group in PCRE
Avoid backtracking inside a grouped token.