Convert YYYY-MM-DD into MM/DD/YYYY.
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