Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Removing non-printing (hex codes) from text files

by toolic (Bishop)
on Feb 06, 2014 at 18:14 UTC ( [id://1073741]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Removing non-printing (hex codes) from text files
in thread Removing non-printing (hex codes) from text files

File::Basename basename

Replies are listed 'Best First'.
Re^4: Removing non-printing (hex codes) from text files
by moesplace (Novice) on Feb 06, 2014 at 18:29 UTC

    Finally got it working. Thanks all!!

    use strict; use warnings; use File::Basename; # Declare package names my $work_file; my $out_file; my @files = <E:\\triggers\\1_MERGE_3326\\tests\\*.hl7>; #$work_file = pop; # If work_file comes from command line, uncomment my $inPath = "E:\\triggers\\1_MERGE_3326\\pass"; my $outPath = "E:\\triggers\\1_MERGE_3326\\converted"; foreach $work_file (@files) { print "$work_file\n"; open (WORK, "<$work_file") or die "Couldn't open $work_file."; # Open +the working file my $outFile = basename($work_file); print "$outFile\n"; open (OUT, ">$outPath\\$outFile") or die "Couldn't open $outPath\\$out +File."; # open an output file while (<WORK>) { chomp; $_ =~ tr/\000-\011\013\014\016-\037//d; print OUT map {"$_\n"} ($_); } # end while close WORK; close $work_file; } # end foreac

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1073741]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-19 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found