User Tools

Site Tools


linux:sed:remove_all_whitespace_including_tabs_from_beginning_of_string

This is an old revision of the document!


Linux - SED - Remove all whitespace (including tabs) from beginning of string

echo "     This is a test" | sed -e 's/^[ \t]*//'

result:

This is a test

Where,

  • s/ : Substitute command ~ replacement for pattern (^[ \t]*) on each addressed line
  • ^[ \t]* : Search pattern ( ^ – start of the line; [ \t]* match one or more blank spaces including tab)
  • ** : Replace (delete) all matched pattern
linux/sed/remove_all_whitespace_including_tabs_from_beginning_of_string.1575974286.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki