fabrizio_start_perl has asked for the wisdom of the Perl Monks concerning the following question:
hostname1;;/tmp/fab/app01/log/app01.log /tmp/fab/app01/log/app02.stder +r /tmp/fab/app01/log/app03.stdout;; hostname2;;C:\temp\log\loga.txt C:\temp\log\logb.txt;;
Can you help me ? Thanks. Fabrizio#!/opt/OV/contrib/perl/bin/perl #Set my variables my $in_file = $ARGV[0]; #my $in_file = 'configuration_logfile_weblogic'; open my $in_fh, '<', $in_file or die "Could not open file $in_file: $! +"; my $fqdn = `hostname`; @hostname_short = split(/\./,$fqdn,2); my $hostname = "@hostname_short[0]"; $hostname=~ tr/A-Z/a-z/; while ( my $line = <$in_fh> ) { if($line =~ m/^$hostname;;(.*);;/) { print $1; } } close $in_fh or die "Could not close file $in_file: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl - pattern matching
by hazylife (Monk) on Mar 31, 2014 at 11:36 UTC | |
by McA (Priest) on Mar 31, 2014 at 14:08 UTC | |
by fabrizio_start_perl (Novice) on Mar 31, 2014 at 11:48 UTC | |
|
Re: Perl - pattern matching
by kcott (Archbishop) on Mar 31, 2014 at 14:01 UTC | |
by fabrizio_start_perl (Novice) on Apr 01, 2014 at 08:10 UTC | |
by fabrizio_start_perl (Novice) on Apr 02, 2014 at 13:27 UTC | |
by fabrizio_start_perl (Novice) on Apr 03, 2014 at 09:46 UTC |