Skip to main content
3 of 4
added 103 characters in body
Michael Durrant
  • 43.7k
  • 73
  • 176
  • 237

sed is a great tool for that:

                           # substitute ("s/")
sed -e 's/^[[:blank:]]*//  # parts of lines that start ("^")  with a space/tab 
        s/[[:blank:]]*$//' # or end ("$") with a space/tab
                           # with nothing (/)

You can use it for your case be either piping in the text, e.g.

cat file | sed -e 's/^{{...

or by acting on it 'inline' -

sed -i 's/...' file

but changing the source this way is "dangerous" as it may be unrecoverable when it doesn't work right (or even when it does!), so backup first!

Michael Durrant
  • 43.7k
  • 73
  • 176
  • 237