b doesn't seem to work. +3 sed user490735 Oct ...">

How to replace space with one blank with sed?

Using sed "s / [[: blank:]] * // g" a> b doesn't seem to work.

+3
source share
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
source

Source: https://habr.com/ru/post/1772024/


All Articles