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 -->
  #7 (permalink)  
Old 06-17-2009
balaji_red83 balaji_red83 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 7
Try the below code. This works even if you have comma more than once in a line.


Code:
 
use strict;
use warnings;
while(<DATA>) {
        s/\"(.*?)\,(.*?)\"/$1.$2/ge;
        print;
}
__END__
"ro,han",rahul,kunal,"sw,ati"
rohan,"r,ahul","kun,al",swati
rohan,"rah,ul",kunal,swati
"ro,han",rahul,kunal,"s,wati"


Last edited by balaji_red83; 06-17-2009 at 07:09 AM..