
preston3271
Novice
Sep 10, 2012, 12:26 PM
Post #1 of 2
(1556 views)
|
Perl One-Liners: Multiple line task exection
|
Can't Post
|
|
Hello, Perl Kings and Queens! I found Walter C. Mankowski's Essential One-Liners guide online and have found it to be great! I am move beyond the guides examples and need to know how to develop multiple task execution in a one liner: For example:
perl -lane ' `ping -n 3 $F[0]` ' pinglist.txt Simple enough. But now I want to add a "For Loop," to the operation for $i 1 . . 5, and then sleep for 10 and continue. How do you create that in a one-liner? Okay I determined the following:
# perl -lane ' for($i=0;$i<3;$i++){`ping -n 3 $F[1]`}' nodelistB.txt But I want the code to advance one line unitil it gets to the <3 limit, pause, and then continue forward in the file. hmm . . .
(This post was edited by preston3271 on Sep 10, 2012, 12:40 PM)
|