tags:

views:

18

answers:

1

How to shutter the "#" characters to one "#" char by sed ?

From:

param=## ### ff ## e ##44

To:

param=# # ff # e #44

+1  A: 

One way to do it using extended regexps:

vinko@parrot:~$ echo "## ### ff ## e ##44" | sed -r s/#+/#/g
# # ff # e #44

With regular regexps:

vinko@parrot:~$ echo "## ### ff ## e ##44" | sed -e s/##*/#/g
# # ff # e #44

Only after the equal sign:

vinko@parrot:~$ echo "param=## ### ff ## e ##44" | sed s/=##*/=#/g
param=# ### ff ## e ##44
Vinko Vrsalovic
and if I want to do it only after the "=" seperator? THX param=## ### ff ## e ##44 to param=# ### ff ## e ##44
yael