How do I remove all spaces from a string in Linux?

Thu Ha

New member
How do I remove all spaces from a string in Linux?
Answer
Use sed ‘s/^ *//g’, to remove the leading white spaces. There is another way to remove whitespaces using `sed` command. The following commands removed the spaces from the variable, $Var by using `sed` command and [[:space:]]. $ echo “$Var are very popular now.”
 

Tìm kiếm

Back
Top