sed How to replace multiple spaces ...



sed How to replace multiple spaces in a string from command line [GNU sed]


echo "one      two       three   four  " | sed "s/^ *//;s/ *$//;s/ \{1,\}/ /g"
OUTPUT: one two three four

ยป