bash remove whitespace lines code example
Example 1: 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
Example 2: bash remove trailing whitespace from every line
# Basic syntax:
awk '{$1=$1};1' your_file