Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash strip preceeding white space

# Basic syntax:
sed 's/^ *//g'

# Example usage:
echo '                    text' # Printing without sed command
-->                     text
echo '                    text' | sed 's/^ *//g' # Pipe to sed command
--> text

# Note, use the following to remove all whitespace from the end of every line
sed 's/ *$//g'
Source by linuxhint.com #
 
PREVIOUS NEXT
Tagged: #bash #strip #preceeding #white #space
ADD COMMENT
Topic
Name
4+3 =