Hello hadrons,
I haven't used Windows in over 20 years but these may work.
(Obviously I can't test these because ... no Windows)
system ('grep -l "DATAmessage.*3\.0" *.xml > 3.0_files_arraydata.txt')
+;
open my $FH, '>', '3.0_files_arraydata.txt'
or die "Cannot open '3.0_files_arraydata.txt' because: $!";
{ local @ARGV = <*.xml>
or die "Cannot find any '*.xml' files\n";
while ( <> ) {
if ( /DATAmessage.*3\.0/ ) {
print $FH "$ARGV\n";
close ARGV;
}
}
}
system ("mv temp_3.0_files_onixarraydata.txt 3.0_files_arraydata.txt")
+;
rename 'temp_3.0_files_onixarraydata.txt', '3.0_files_arraydata.txt'
or die "Cannot move 'temp_3.0_files_onixarraydata.txt' because: $!
+";
system ("cat *files_arraydata.txt > data2.txt");
open my $FH, '>', 'data2.txt'
or die "Cannot open 'data2.txt' because: $!";
{ local @ARGV = <*files_arraydata.txt>
or die "Cannot find any '*files_arraydata.txt' files\n";
print $FH $_ while <>;
}
system ("rm data2.txt");
unlink 'data2.txt'
or die "Cannot delete 'data2.txt' because: $!";
system ("sort -u data2.txt > data.txt");
open my $IN, '<', 'data2.txt'
or die "Cannot open 'data2.txt' because: $!";
open my $OUT, '>', 'data.txt'
or die "Cannot open 'data.txt' because: $!";
{ my %unique;
print $OUT sort grep { ! $unique{ $_ }++ } <$IN>;
}