View Single Post

   
  #4 (permalink)  
Old 01-05-2008, 07:03 AM
Tad McClellan
 
Posts: n/a
Default Re: string substitution help (search and replace)

Ray Muforosky <izombe@yahoo.com> wrote:


> I need to do string substitution


> asda tgn=0513, thr=122, options=sched,
> asca tgn=055, thr=562, options=sched,


> where there is "thr=###" I need make it "thr=##" deleting the first
> digit.


> asda tgn=0513, thr=22, options=sched,
> asca tgn=055, thr=62, options=sched,



> I know less 15 lines of perl script will do it, but I'm wondering if
> there is another way.



perl -pe 's/thr=\d(\d\d)/thr=$1/' filename


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Reply With Quote