PJT has asked for the wisdom of the Perl Monks concerning the following question:
call started 00:00:00, call ended 00:00:00, total modem active time 00 +:00:00
Modem Line 0/$i : total modem active time 00:00:00
#!/usr/sbin/perl -w # Program for modem pool log manipulation open(IN, $ARGV[0]) || die "cannot open $ARGV[0] for reading: $!"; open(OUT, ">$ARGV[1]") || die "cannot create $ARGV[1]: $!"; $i=0; while(<IN>){ if(/^call started/){ print OUT s/^call.*total/Modem Line 0\/$i : / ."\n"; $i++; } } close(IN); close(OUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: while loop, search & replace
by ikegami (Patriarch) on Oct 01, 2004 at 17:54 UTC | |
by Anonymous Monk on Oct 01, 2004 at 18:42 UTC | |
by ikegami (Patriarch) on Oct 01, 2004 at 19:12 UTC | |
|
Re: while loop, search, and replace while loop, search & replace
by tmoertel (Chaplain) on Oct 01, 2004 at 18:01 UTC |