sed Examples
Heads up
These examples got mangled in a site transition. TODO: is to get them fixed.
Starting to collect some of the sed command I run. Not sure if they'll be interesting or not.
Note
A good enhancement would be to make little snippts instead of full thing. Like how do I capture a parenthesis
Convert markdown images to neopolitan
<<aws-20120918--1724-02.jpg|img|caption: Image: aws-20120918--1724-02.jpg>>
Code
sed -E -i "" 's/\!\[Image: [^]]+\]\(([^\)]+)\)/<<\1|img>>/g' a.txt
Results
TODO: Fix this result
<<link|![image](https://imgs.xkcd.com/comics/11th_grade.png)|http://xkcd.com/519/>>
Code
sed -E -i "" 's/\[\!\[image\]\(([^\)]+)\)([^\)]+)\)/<<\1|img>>/g' a.txt
Results
<<https://imgs.xkcd.com/comics/11th_grade.png|img>>
!<<link|My Father's Flag|/images/aws-20120427--1127-01>>
Code
sed -E -i "" 's/\!\[([^\]+)]\(([^\)]+)\)/<<\2|img|caption: \1>>/g'
Results
<</images/aws-20120427--1127-01|img|caption: My Father's Flag>>