utpalmtbi has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to replace characters in file through perl regex like :
open my $hfile, $ARGV[0] or die "Can't open $ARGV[0] for reading: $!" +; while( my $line = <$hfile> ) { $line =~ s/\s+/\n/g; print $line; } close $hfile;
I have to run this script for all the files in my folder so I use following command described previously in this forum as
for %f in (*.txt) do @yourscript.pl %fIt works fine but I want to save the output generated by each input file in a subfolder. For example if my current folder contains the files named list1.txt, list2.txt etc.. an 'outfile' subfolder should generate and the results for each file shouls ve saved in it as out1.txt, out2.txt etc.. But I don't know how to do that..Plz help
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to redirect output in different files
by space_monk (Chaplain) on Jun 14, 2013 at 06:46 UTC | |
|
Re: how to redirect output in different files
by poj (Abbot) on Jun 14, 2013 at 06:58 UTC | |
|
Re: how to redirect output in different files
by jwkrahn (Abbot) on Jun 14, 2013 at 06:46 UTC | |
by choroba (Cardinal) on Jun 14, 2013 at 07:18 UTC |