Hi Monks,
I am having problems reading a file that I have processed.
I am trying to remove the return characters in the lines of a file.
Input is
"data", "data" ,"data", "data","data", "data" "data", "data" ,"data", "data with new line ","data", "data" "data", "data" ,"data", "data","data", "data"
The code that I am using is:
open (OUTFILE, '> '.$ARGV[1].'temp.csv')or die $!; open (INFILE, $ARGV[0]) or die $!; while (<INFILE>) { chomp; if($_ !~ /"$/){ $_=~ s/[\n\r]//g; while($_ !~/"$/){ $test = <INFILE>; $test =~ s/[\n\r]//g; $_ = $_." ".$test; } $_ = $_."\n"; } print OUTFILE $_; } } close (INFILE); close (OUTFILE); exit;
The problem is that after I have created the file, It only reads the lines that have been processed by the if statement.
20081016 Janitored by Corion: Added formatting, removed pre tags, as per Writeup Formatting Tips
In reply to Reading Multiple lines by mick2020
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |