in reply to System Call for various serials in a for loop

Thanks for all the Comments!

First, the chomping did its part, now my program at least works with each serial i put in the text file instead of just the first.

Second, using system instead of exec, well i started with system, then read that it didn't return from execution (or at least i thought i read it) and then turned to exec. Seemingly, i was wrong :)

Third, i tried the -F -f option with grep, but this did not achieve my goal.

My new problem is this: when i execute the program, the output looks like:
Now Processing #1 .log: No such file or directory Now Processing #2 .log: No such file or directory Now Processing #3 .log: No such file or directory
and so on. The rogue line is this one (clearly):
system("echo grep $serial logs* > $serial.log")
This line used to work when i used exec, but with system it doesn't. Any hints on how to solve this problem?

And by the way: the speed you guys show is amazing :) I never expected so much as simple replies until tomorrow, but you came up with real solutions almost instantly. Respect!

greetings, Elbarto

Replies are listed 'Best First'.
Re^2: System Call for various serials in a for loop
by RMGir (Prior) on Jun 28, 2007 at 13:17 UTC
    Elbarto,

    Those system errors are strange. Are you running under use warnings and use strict?

    My guess is that in your real code, $serial is typo'd, perhaps?


    Mike
      Mike,

      2xYes, 1xNo.

      Theses errors indeed ARE strange,

      i run under use warnings and strict and

      NO, i just triple checked, $serial is not typo'd (i use vim with syntax completion after all, just to avoid these errors (and for comfort reasons :))).
        You have to quote the special chars:
        echo "The # here does not begin a comment." echo 'The # here does not begin a comment.' echo The \# here does not begin a comment. echo The # here begins a comment.