sed Removing whitespace around certain character

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-03-31T12:30:10Z Indexed on 2010/03/31 12:33 UTC
Read the original article Hit count: 416

Filed under:
|

Hi, what would be the best way to remove whitespace only around certain character. Let's say a dash - Some- String- 12345- Here would become Some-String-12345-Here. Something like sed 's/\ -/-/g;s/-\ /-/g' but I am sure there must be a better way.

Thanks!

© Stack Overflow or respective owner

Related posts about sed

Related posts about whitespace