[Asterisk-Users] How to quickly replace ', ' with '|' in dialplans?

Chris Coulthurst asterisk at shuksan.com
Sat Jun 4 22:33:30 MST 2005


There is a perl script out there called 'sarep' which is short for
search-and-replace that I use quite frequently for such things.

Check it out at this URL:
http://tarp.worldserve.net/software/sarep.html

You can type something like:
# sarep 'Sip/203' 'Zap/2r2' /etc/asterisk/extensions.conf

All Sip/203s become Zap/2r2s.

Chris Coulthurst
chris at shuksan.com
 

|-----Original Message-----
|From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
|bounces at lists.digium.com] On Behalf Of Steve
|Sent: Saturday, June 04, 2005 5:09 PM
|To: Asterisk Users Mailing List - Non-Commercial Discussion
|Subject: Re: [Asterisk-Users] How to quickly replace ',' with '|' in
|dialplans?
|
|Cool!!!!
|Good to know!
|I use the heck out of vi but by all means not a power user.
|
|Thanks for that tidbit!
|
|Steve
|
|
|
|
|
|
|
|On Sat, 4 Jun 2005, Jeremy McDermond wrote:
|
|> On Jun 4, 2005, at 1:30 PM, kleis-asterisk-dev at tiscali.it wrote:
|>
|>>> -- Messaggio Originale --
|>>> Date: Sat, 4 Jun 2005 14:52:42 -0400 (EDT)
|>>> From: Steve <asterisk at michiganbroadband.com>
|>>> To: Asterisk Users Mailing List - Non-Commercial Discussion
|>>> <asterisk-users at lists.digium.com>
|>>> Subject: Re: [Asterisk-Users] How to quickly replace ',
|>>>     ' with '|' in dialplans?
|>>> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion
|>>> <asterisk-users at lists.digium.com>
|>>>
|>>>
|>>>
|>>> I stink at regular expressions, but can always find what I need to
get
|a
|>>>
|>>> job done using google :-)
|>>>
|>>> Don't use vi (unless you figure out how to do it in vi).
|>>> I won't be much help there.
|>>>
|>>> in this case sed is your friend.
|>>>
|>>> It's a breeze to use too.
|>>>
|>>> Here's what it looks like:  sed -e
"s/text_to_find/text_to_replace/g"
|>>> inputfile > outputfile
|>>> and yup you can use the same name for both files to simply update
the
|>>> file.
|>>>
|>
|> You can do the same thing in vi:
|>
|> :1,$s/text_to_find/text_to_replace/g
|>
|> but sed works too.
|>
|>
|>>> Make sure you back it up first of course.
|>>>
|>>> Here's a link with some more examples using sed:
|>>> http://pegasus.rutgers.edu/~elflord/unix/sed.html
|>>>
|>>>
|>>> Hope this helps!
|>>>
|>>> Steve
|>>>
|>>>
|>>
|> _______________________________________________
|> Asterisk-Users mailing list
|> Asterisk-Users at lists.digium.com
|> http://lists.digium.com/mailman/listinfo/asterisk-users
|> To UNSUBSCRIBE or update options visit:
|>  http://lists.digium.com/mailman/listinfo/asterisk-users
|>
|_______________________________________________
|Asterisk-Users mailing list
|Asterisk-Users at lists.digium.com
|http://lists.digium.com/mailman/listinfo/asterisk-users
|To UNSUBSCRIBE or update options visit:
|   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list