wcj75019 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $agent = "best1agent_start"; my $bgs=<<HERE; 'bgs') /usr/bin/su - patrol /usr/adm/best1_default/bgs/scripts/best1collect + -q>>\$LOG 2>>\$LOG ;; HERE my $collect = " /usr/bin/su - patrol /usr/adm/best1_default/bgs/scr +ipts/best1collect -q>>\$LOG 2>>\$LOG\n"; my $cf_dir = "/export/home/f358118/sysedge"; open SH_FILES, "sys.sh" or die "Error: $!"; my @sh_f=<SH_FILES>; close SH_FILES; foreach my $sh(@sh_f){ chomp $sh; open(OUT, ">/$cf_dir/$sh".".OUT")or die "ERROR $!"; my $line; open (SH, "$cf_dir/$sh") or die "ERROR $!"; while ($line = <SH>){ if($line =~ m/$agent/){ $line = $collect; } elsif ( $line =~ m/best1collect/) { next; } elsif ($line =~ m/'syslogd'\)/){ my $newline = $. + 3; $newline = $bgs; print OUT "$newline\n"; } #else { next }; print OUT $line; print $line; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: if elsif elsif prints all three.
by Errto (Vicar) on Feb 27, 2008 at 22:06 UTC | |
Re: if elsif elsif prints all three.
by pc88mxer (Vicar) on Feb 27, 2008 at 20:56 UTC | |
by wcj75019 (Acolyte) on Feb 27, 2008 at 21:23 UTC | |
by wcj75019 (Acolyte) on Feb 27, 2008 at 21:30 UTC | |
Re: if elsif elsif prints all three.
by chromatic (Archbishop) on Feb 27, 2008 at 21:05 UTC | |
by wcj75019 (Acolyte) on Feb 27, 2008 at 21:47 UTC | |
Re: if elsif elsif prints all three.
by hexcoder (Curate) on Feb 27, 2008 at 22:26 UTC | |
by wcj75019 (Acolyte) on Feb 27, 2008 at 23:20 UTC | |
Re: if elsif elsif prints all three.
by pc88mxer (Vicar) on Feb 28, 2008 at 14:33 UTC | |
by wcj75019 (Acolyte) on Feb 28, 2008 at 17:36 UTC |