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 [EMAIL PROTECTED] |-----Original Message----- |From: [EMAIL PROTECTED] [mailto:asterisk-users- |[EMAIL PROTECTED] 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, [EMAIL PROTECTED] wrote: |> |>>> -- Messaggio Originale -- |>>> Date: Sat, 4 Jun 2005 14:52:42 -0400 (EDT) |>>> From: Steve <[EMAIL PROTECTED]> |>>> To: Asterisk Users Mailing List - Non-Commercial Discussion |>>> <[email protected]> |>>> Subject: Re: [Asterisk-Users] How to quickly replace ', |>>> ' with '|' in dialplans? |>>> Reply-To: Asterisk Users Mailing List - Non-Commercial Discussion |>>> <[email protected]> |>>> |>>> |>>> |>>> 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 |> [email protected] |> 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 |[email protected] |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 [email protected] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
