AWK - Delete both leading and trailing whitespaces from each line
awk
'{ gsub(/^[ \t]+|[ \t]+$/, ""); print }'
file.txt
Example
file.txt
aaaaa bbbbb ccccc ddddd eeeee
returns:
aaaaa bbbbb ccccc ddddd eeeee