The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-17-2008
cooldude cooldude is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 44
Perl: Getting back reference from s modifier

My input text has the following pattens:

Code:
  func_a(3,
         4,
         5);

I want to replace it with this:

Code:
   
  func_b(3,
         4,
         5,
         6);

I'm trying the following expression, but it does not work:

Code:
perl -p -e "s/func_a\((.*)?\);/func_b(\1,\n6)/s" < file |more

Any ideas? Thanks.