# Given this pattern "b {a} c" puts this replacement "b {a} c |||| aList. Run with sed -n #s/.*\(\(\b.\{4,\}\)\s*{\(.*\2.*\)}\).*/\1 \2List/p s/.*[^']{\(.*[^']\)}.*/& |||| \1List/p