How to replace space with one blank with sed?
1 answer
You need to change the asterisk to a plus sign:
sed "s/[[:blank:]]\+/ /g" a>b
or use an alternative that means the same thing:
sed "s/[[:blank:]][[:blank:]]*/ /g" a>b
or
sed "s/[[:blank:]]\{1,\}/ /g" a>b
In addition, it is more useful to send error messages or the exact ways in which the behavior differs from expectations, since “it seems that it does not work” conveys very little information.
+4