Home

sed Examples

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>>
sed -E -i "" 's/\!\[Image: [^]]+\]\(([^\)]+)\)/<<\1|img>>/g' a.txt
results start
<<link|![image](https://imgs.xkcd.com/comics/11th_grade.png)|http://xkcd.com/519/>>
sed -E -i "" 's/\[\!\[image\]\(([^\)]+)\)([^\)]+)\)/<<\1|img>>/g' a.txt
results start
TODO: Rerun this to show the results
sed -E -i "" 's/\!\[([^\]+)]\(([^\)]+)\)/<<\2|img|caption: \1>>/g'
results start
~ fin ~