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>;
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.