b doesn\'t seem to work.You need to change the asterisk to a plus sign:" />
开发者

How to replace whitespace with one blank using sed?

开发者 https://www.devze.com 2023-01-22 17:08 出处:网络
Using sed \"s/[[:blank:]]开发者_运维百科*/ /g\" a>b doesn\'t seem to work.You need to change the asterisk to a plus sign:

Using sed "s/[[:blank:]]开发者_运维百科*/ /g" a>b doesn't seem to work.


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

Also, it's more helpful to post error messages or precise ways that behavior differs from expectations since "doesn't seem to work" conveys very little information.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号