[H-GEN] regular expressions
Michael Anthon
michael at anthon.net
Fri Aug 18 00:37:32 EDT 2000
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Please observe the list's charter. ]
>
> sed 's/ */|/g'
>
If you want to handle tabs and such as well, try this...
sed "s/[[:space:]]\+/|/g"
or
sed s/[[:space:]]\\+/\|/g
sed does not seem to support the \s as a shrtcut for whitespace. Using
* seems to give an odd result. Perhaps someone could explain this since
I can't figure it out....
bash> echo -e ": : : :" | sed "s/[[:space:]]*/|/g"
|:||:||:||:|
Cheers
Michael Anthon
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.
More information about the General
mailing list