Delete Leading Spaces using Sed

sed -e 's/^[ ]*//'

Delete Leading Spaces and Tabs (White Space) using Sed

sed -e 's/^[\t ]*//'

Delete Trailing Spaces using Sed

sed -e 's/[ ]*$//'

Delete Trailing Spaces and Tabs (White Space) using Sed

sed -e 's/[\t ]*$//'

Convert all Tabs to Spaces (The Bonus)

tr '\011' '\040'

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Also Like

Error While Parsing Json using Python – TypeError: list indices must be integers, not str

Jotting this down for fellow googlers. I recently started learning a bit…

Makefile Tricks: Arithmetic – Addition, Subtraction, Multiplication, Division, Modulo, Comparison

While working on a project, I needed to do some calculations inside…