text=" ATGGTV AGTGACCTAGAGTGATGA G GGRTTT"
echo "$text" | sed 's/ //g'
OR
echo "$text" | awk '{ gsub(/ /,""); print }'
Return: ATGGTVAGTGACCTAGAGTGATGAGGGRTTT
echo "$text" | sed 's/^ //g'
echo "$text" | sed 's/ \$//g'
#Multiple space
cat /tmp/test.txt | sed 's/[ ]\+/ /g'
echo "$text1" | awk '{ gsub(/[ ]+/," "); print }'
cat /tmp/test.txt | awk '{ gsub(/[ ]+/," "); print }'