Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matching garbage text using PERL Regular Expressions and

Status
Not open for further replies.

sdipo

Programmer
Jun 25, 2004
3
US
Hi there,

I will like to identify garbage text in a file. I have tried the code below using the octave value of unprintable characters as the matching pattern but it does not seem to work. Any help will be much appreciated.

#!/usr/local/bin/oraperl
#
open(INP, $ARGV[0]) || die "Cannot open file! $USAGE \n";
while(<INP>) {

if ($_ =~ /[\000-\040]/)
{print "Garbage text exists in this file\n";}
else
{print $_;}
}

Thanks
 
Try using the hexadecimal syntax instead - ($_ =~ m/[\x00-\x20]/).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top