the contents of processed file:#!/usr/bin/perl $file = @ARGV[0]; $out_file = $file.".out"; my $count = 0; print "Processing file: $file\n"; print "Output file: $out_file\n"; open FILE, "$file" or die "cannot open $file file"; open OUT, ">>$out_file" or die "cannot create $out_file file"; #go through the file rows while (<FILE>) { chomp; # if row contain non-ASCII symbols - it is counted if ($_ =~ /[[:^ascii:]]/) { print "String before modification:\n $_ \n"; s/[[:^ascii:]]/q{<} . unpack(q{H2}, $1) . q{>}/eg; print "String after modification:\n $_ \n"; print OUT "$_\n"; $count++ ; } else { print OUT "$_\n"; } } print "there are $count possibly corrupted rows\n"; close FILE; close OUT;
0,1,,,1,~=_<>}[]||$? £??§^`??¿ ?. Qu est çe quil Y a Yå,0,20120 +306101731 0,1,,,1,Teá,0,20120314104403 0,1,,,1,Q<8a>rUì ,0,20120306103345 1,1,,,3,,0,20120331152610 1,1,,,3,,0,20120331152612
In reply to Re^4: hex in regexp
by shamanoff
in thread hex in regexp
by shamanoff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |