How to use matching group in sed replacement 3 February 2018·22 words·1 min Debian Tips Table of Contents With one capture group With more capture groups Table of Contents With one capture group With more capture groups With one capture group # sed -i 's/^Title\: \(.*\)$/title: "\1"/g' *.md With more capture groups # sed -i 's|^Date: \([[:digit:]]\{4\}\)/\([[:digit:]]\{2\}\)/|date: \1-\2-|g' *.md