example <title>this is it</title>
if we want to extract just this is it
.
echo '<title>this is it</title>' | sed -nE 's/<title>(.*)<\/title>/\1/p'
(class=".*?")
I had to use this to do a global find/replace all within many files to reformat things like:
{{this}}
to
{{ this }}
Using gnu-sed
instead of OS X sed
because of compatability issues using -i
with Mac version of sed. (brew install gnu-sed)
find . -type f -name '*.njk' | while read file;
do
gsed -i 's/{{\(\S\)/{{ \1/g' $file;
gsed -i 's/\(\S\)}}/\1 }}/g' $file;
done