cut off all whitespace from end of file bash 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: remove spaces in wc output'
awk '{$1=$1;print}'