>>Here the problems are :

>>1) The new line character '\n' cannot be detected.

Well, I'm not getting exactly what your problem is, I'm afraid! 

 

>>2)I am not able to print the unmatched data i.e in the above example '45'
doesn't match the regex in the while loop so this cannot be printed in the
output file.

Obviously it won't :-)  

Ok, do this, have 2 separate variables, one for regex matches ( i.e. $line)
and one for printing to the output file ($lineout). 

when u have a line from the file, copy the same to this new variable ( i.e.
$lineout = $line ). 

Now,  you'll replace the matched pattern by empty string in $line, but
$lineout will remain intact, and whatever changes you want to do in the line
before printing it to OUT file, do them in the $lineout. And print $lineout
to the OUT file. So unmatched part will also remain there.

 

>>Plz suggest me in the matter . Is there any way to find the data which is
unmatched with the regex.

Can you attach a sample input file, your expected output and the code with
it?

 

 

Thanks for the help

 

Regards

Anand

Reply via email to