Jalcock501 has asked for the wisdom of the Perl Monks concerning the following question:
Hey Guys
Another glorious day in scripting heaven, when all of a sudden a wild request appears. I need to create a script that checks two files together that have the same name but a different extension. i.e. (*.in) and (*.out)
So far I have managed to get the information I need from the *.in file but I have no idea how to check it against the information in the .out file.Also I need to check that the file names(without the extension match)
This is my code so far:At the moment it only prints the unique identifier from the *.in the file to a seperate file to check that this is correct. The identifier is A00000 (one alpha 5 numeric) and is the 72nd bit offset from the 4th line, in the *.in file. However is 2nd line in and the 28th bit across in the *.out file. Please help!use strict; my @files = <*.in>; for my $file (@files) { open my $read, '<', $file; open my $write, '>', "$file.log"; my $scid; my @lines; while(<$read>) { @lines = split('', $_); if($. == 3) { $scid = substr $_, 72,6; print $write "$scid\n"; } } #check where files match close($read); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Find a file with same name but different extension
by toolic (Bishop) on Sep 24, 2013 at 14:06 UTC | |
by Lotus1 (Vicar) on Sep 24, 2013 at 19:54 UTC | |
Re: Find a file with same name but different extension
by daxim (Curate) on Sep 24, 2013 at 13:21 UTC | |
by Jalcock501 (Sexton) on Sep 24, 2013 at 13:43 UTC |
Back to
Seekers of Perl Wisdom