[asterisk-users] script to trim sip.conf

2011-05-17 Thread satish patel

Hey Guys! 

Sorry i am posting scripting question in asterisk forum but i had no choice. 
also i am not script expert so i though anyone here might help me. 

following is my example sip.conf now i want to add  
accountcode=callerid_name  for example  accountcode=Katie Wilson  in 
entire file. we have around 200 extension could someone help me to figure out 
how to do that with perl script or shell would be fine.

[100](seb-exten)
callerid=Katie Wilson 100
mailbox=100@default

[200](seb-exten)
callerid=Ramona Minero 200
mailbox=200@default
  --
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] script to trim sip.conf

2011-05-17 Thread Mark Deneen
On Tue, May 17, 2011 at 4:21 PM, satish patel satish...@hotmail.com wrote:

  Hey Guys!

 Sorry i am posting scripting question in asterisk forum but i had no
 choice. also i am not script expert so i though anyone here might help me.

 following is my example sip.conf now i want to add
 accountcode=callerid_name  for example  accountcode=Katie Wilson  in
 entire file. we have around 200 extension could someone help me to figure
 out how to do that with perl script or shell would be fine.

 [100](seb-exten)
 callerid=Katie Wilson 100
 mailbox=100@default

 [200](seb-exten)
 callerid=Ramona Minero 200
 mailbox=200@default


Satish,

Give this a shot:

cat sip.conf | perl -pi -e s/^callerid=\(.*)\ (.*)/callerid=\\$1\
\$2\naccountcode=\\$1\/  sip.conf.new

and compare them.
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] script to trim sip.conf

2011-05-17 Thread satish patel

Holy cow! you made my day

Thank you so much... It works great!!! 

S. 

From: mden...@gmail.com
Date: Tue, 17 May 2011 17:02:55 -0400
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] script to trim sip.conf

On Tue, May 17, 2011 at 4:21 PM, satish patel satish...@hotmail.com wrote:







Hey Guys! 

Sorry i am posting scripting question in asterisk forum but i had no choice. 
also i am not script expert so i though anyone here might help me. 

following is my example sip.conf now i want to add  
accountcode=callerid_name  for example  accountcode=Katie Wilson  in 
entire file. we have around 200 extension could someone help me to figure out 
how to do that with perl script or shell would be fine.



[100](seb-exten)
callerid=Katie Wilson 100
mailbox=100@default

[200](seb-exten)
callerid=Ramona Minero 200
mailbox=200@default



Satish,
Give this a shot:
cat sip.conf | perl -pi -e s/^callerid=\(.*)\ (.*)/callerid=\\$1\ 
\$2\naccountcode=\\$1\/  sip.conf.new 


and compare them. 

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users  
  --
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users