LoneWolf wrote:
I have to parse a big file and I do it line by line to keep stuff going
correctly. I am at a point where I need it to go through and replace every
" with inches and ' with feet, IF item in front of it is a digit (0-9).


I have this written in the script to parse it:
        while ($line = <OLDFILE>)  {
#               $line = $line =~ /^\s*(.*)\s*\n$/;
                $line =~ s/^ //;
                $line =~ s/ $//;
                $line =~ s/\t/|/g;
                $line =~ s/\s+/ /mg;
                $line =~ s/^\s*//mg;
                $line =~ s/\s*$//mg;
                $line =~ s/\s*$//mg;
###  The following lines mod the files to reflect inches and feet
                $line =~ s/"/in./mg;
                $line =~ s/'/ft./mg;
                print NEWFILE "$line\n";

help!

What exactly is it you need help with? The only potential problem that I see is that the while loop needs a closing '}' bracket. Also, you might want to escape the ' and " to \' and \".


--
Andrew Gaffney


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



Reply via email to