Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

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.

<<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>>