Skip to main content
2 of 4
added 103 characters in body
Michael Durrant
  • 43.7k
  • 72
  • 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 (/)
Michael Durrant
  • 43.7k
  • 72
  • 176
  • 237