Hello,
I'm trying to write a script that reads a file line by line and if the line
contains a space it puts quotation marks around it and writes it to another
file.  I mostly have this working except that in the case of the lines that
contain the space it puts the quotation mark at the beginning of the next
line.  My guess is that
 print OUTFILE ($line);
also feeds a CR.  Is there a way around this?
thanks,
gc




unless (open(INFILE, "accounts.txt")) {

        die ("Cannot open input file accounts.txt.\n");
}

unless (open(OUTFILE, ">nospace.txt")) {

        die ("Cannot open output file nospace.txt.\n");
}

$line = <INFILE>;

while ($line ne "") {

if ($line =~ / +/) {
     print OUTFILE ('"');
     print OUTFILE ($line);
     print OUTFILE ('"');
}
else {
     print OUTFILE ($line);
}

$line = <INFILE>;

}
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to