[CentOS] text processing problem with bash/perl

Fri Feb 13 00:46:46 UTC 2009
Robinson Tiemuqinke <hahaha_30k at yahoo.com>

Hi,

 Anyone has some ways for the following text processing problem? I have a text file containing two stanzas attached below. I want to uncomment the stanza with 'host=localhost' line, while left the other stanza unchanged.

...

/* udp_send_channel {
  host=localhost
  port = 10017
  ttl = 1
} */

/* udp_send_channel {
  host=ganglia100.ec2.example.com
  port = 10017
  ttl = 1
} */

...

If I use command below then both stanza will be altered... Please help.

sed  -i -e '/^\/\* udp_send_channel/, /} \*\// {s/^\/\* udp_send_channel/udp_send_channel/g; s/\} \*\//}/g; }'

--David