text processing problem with bash/perl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


      
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux