How to use matching group in sed replacement
Feb 3, 2018
1 minute read

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


comments powered by Disqus