Well, I, like others have recommended, worry about what those
binary characters really represent in your documents.
But it you want to just strip them all away, you could try:
for my $file (@ARGV) {
my $fout = "$file.stripped";
my $fh;
open( $fh, ">$fout" ) or die "Trouble creating '$fout' : $!\n";
while (<>) {
s/\P{IsPrint}//g;
print $fh $_ . "\n";
}
close( $fh ) or die "Trouble closing '$fout' : $!\n";
}
I did test this. The key here is to use the \P{IsPrint} character
class in your substitutions.
Hope this helps.
--
Mike Arms
-----Original Message-----
From: Mohanty, Debi (MED, TCS) [mailto:Debi.Mohanty@;med.ge.com]
Sent: Thursday, October 31, 2002 11:00 AM
To: Haimov, Eugene; [EMAIL PROTECTED]
Subject: RE: deleting control Characters...... Please help
Hi Eugene,
Thanks for your help. As I talked to the guys here, and as per
them we don't bother about those control characters.
We just need to ingonre those characters (the binary characters that I
am getting on my file, which looks like small square and rectanlge
filled with black colors ....:(....). So Will any one please suggest me
how could I able to clean the file from these characters.
Thanks&Regards
Debi
-----Original Message-----
From: Haimov, Eugene [mailto:eugene.haimov@;aecio.com]
Sent: Thursday, October 31, 2002 11:41 AM
To: Mohanty, Debi (MED, TCS); [EMAIL PROTECTED]
Subject: RE: deleting control Characters...... Please help
Hi Debi,
I guess, the silence that you get in response to
your post can be explained by the fact that your question
is too vague.
The answer is: yes, you can do anything with Perl, but
maybe you shouldn't do what you saying you want to.
If the mainframe puts those wierd characters in the file,
there must be a reson why. Maybe you will lose the file
structure if you remove them.
Try to explain in more details what is yuour goal.
Hope that helps,
Eugene Haimov
-----Original Message-----
From: Mohanty, Debi (MED, TCS) [mailto:Debi.Mohanty@;med.ge.com]
Sent: Thursday, October 31, 2002 12:29 PM
To: [EMAIL PROTECTED]
Subject: deleting control Characters...... Please help
Hi,
I have a data file (which I get from the Mainframe), which
contains some sort of control characters. Is there any way where by I
can clean the file with perl. When I tried to copy those characters on
the file it shows me a message saying
"cannot cut, copy or drag and drop text containing null (code=0)
characters". Is there any way I can clean these characters from the file
by using perl.
Thanks&Regards
Debi
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs