Hello, wise Monks!
My problem is the following:
i have a file with several serial numbers, e.g. serials.txt.
Furthermore i have about 700MB worth of database-extracts covering the last 7 years. The task i want to accomplish now looks like this:
Open the serials.txt, read the contents to an array, iterate over this array and with every serial in the file do this:
exec("grep $serial logs* > $serial.log");
where logs* are the files i want to grep through. this works fine when executed with a single serial, but as soon as i try to do it in a loop, it doesnt do anything. It looks like this:
open(SERIALS, "serials.txt") or die("can't open serials.txt");
@serials = <SERIALS>;
for my $serial (@serials) {
print "now processing $serial";
exec("grep $serial logs* > $serial.log");
}
I fear that the solution is painfully obvious, but i'm stuck here now for a good while. Oh, and btw. Super Search didn't help me, i really tried :)
greetings,
Elbarto
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.