#!/usr/bin/perl -w
#this file is for grepping within vdx files, and outputs the following
+:
#filename:<#of hits>:<arguments>
#filename:2:myargument
open ARGUMENTS, "<","file";
@files = <*.vdx>;
@arguments = <ARGUMENTS>;
$ENV{file}=$file;
$ENV{argument}=$argument;
foreach $file (@files) {
#$copyfile="\"".$file."\"";
foreach $argument (@arguments) {
chomp $argument;
#print "$copyfile\n";
$results=`grep -c -H "\$argument" "\$file"` /dev/null;
chomp $results;
print "$results:$arguments\n";
}
}
results in the following output:
Unquoted string "dev" may clash with future reserved word at ./nelson.
+pl line 15.
Unquoted string "null" may clash with future reserved word at ./nelson
+.pl line 15.
Use of uninitialized value in scalar assignment at ./nelson.pl line 8,
+ <ARGUMENTS> line 1.
Use of uninitialized value in scalar assignment at ./nelson.pl line 9,
+ <ARGUMENTS> line 1.
grep: : No such file or directory
Argument "dev" isn't numeric in division (/) at ./nelson.pl line 15, <
+ARGUMENTS> line 1.
Argument "" isn't numeric in division (/) at ./nelson.pl line 15, <ARG
+UMENTS> line 1.
Illegal division by zero at ./nelson.pl line 15, <ARGUMENTS> line 1.
"Two Wheels good, Four wheels bad."
-
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.
|