in reply to regex pattern match
There's only one problem bugging me .. How do i exclude the double quoted string from the pattern match in the split statement ..Once i am able to do that , the rest should be easy.. else it jus increases the amount of processing i need to do...$in_file = "test.txt"; $out_file = "testout.txt"; open (IN, "<$in_file") or die "Can't open $in_file: $!\n"; open (OUT, ">$out_file") or die "Can't open $out_file: $!\n"; while ( $line = <IN> ) { @fields = split /,/, $line; $line = join ",", $fields[0], @fields[1..5]; print OUT $line; print OUT "\n"; } close IN; close OUT; #read in output file and print to screen to confirm open (TEST, "<$out_file") or die "Can't open $out_file: $!\n"; while ( <TEST> ) { print; } close TEST;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regex pattern match
by McA (Priest) on Mar 29, 2013 at 09:54 UTC |