The below snippet is taken from the logfile.I am using while loops because there are many lines above and inbetween this snippet.
when i ran the program like this--
but in output file that is temp12, it is not printing anything.
Kindly suggest wha is wrong here.
#!/usr/local/bin/perl
open (MYFILE, 'logs_report');
while (<MYFILE>) {
$rec=$_;
chomp ($rec);
@arr=split(/ /,$rec);
print $rec,"\n" if ($arr!~/OK/);
open (MYF, '>data.txt');
print $rec,"\n" if ($arr!~/OK/);
close (MYF); (14 Replies)
Hi,
This is my piece of code.
my $logFile = $ARGV;
die "usage: $0 <logFile>" unless $logFile;
die "Logfile $logFile doesn't exist" unless -f "$logFile";
open(my $log, "<", $logFile) or die "Can't open $logFile for reading.";
print "Processing file $logFile...\n";
#my $authenticates... (2 Replies)
Hi,
I have file: data.log.1
### s1
main.build.3495
main.build.199
main.build.3408
###s2
main.build.3495
main.build.3408
main.build.199
I want to read this file and store in two arrays in Perl.
I have following command, which is working fine on command prompt.
perl -n -e... (1 Reply)
Hi,
I have a perl script which prints the epoch value of given date.
I want to use its output in a shell script.Can someone suggest me how to do it.
Thanks and Regards
Jyothi (4 Replies)
Good morning! Im trying to write and learn at the same time a simple script. fTHe script should tell me if a number is odd or even/
#!/usr/bin/perl
$num = 10;
$string1 = "This number is odd";
$string2 = "This number is even";
if ($num /= 2) {
print "$string1\n";
}else{
... (3 Replies)
It is a basic Perl CGI question, I want to print out "Processing ... " while backend script /script/wait.pl is still running.
But acctually, nothing appeared in browser untill /script/wait.pl finished.
print "Content-type:text/html\r\n\r\n";
print '<html>';
print '<head>';
print... (4 Replies)
i managed to write a perl script for nagios. now, the script works. but i think there's somethign wrong with the exit codes. because the script doesn't show the output of the results in nagios, it instead shows null.
please tell me what i'm doing wrong here:
#!/usr/local/bin/perl
use... (2 Replies)
Hi All,
I have an expect script that I would like a perl script to call in order to login to a node and run in a single command.
The command being running is a log of events so has lots of data that will be output. I would like to output that data to a file.
Would anyone be kind enought... (1 Reply)
i have perl script that used to be working great , once i edit it in windows
and convert it to UTF-8 and then via FTP return it .
also did:
chmod +x foo.pl
and then when i try to run it :
./foo.pl
im getting this error:
./foo.pl: Exec format error. Wrong Architecture.... (4 Replies)
Hi team,
getting output logs wrong in different format from telnet script ...
getting Output.txt
macro_outdoor_dist-6.0.0(v4_0_2) DN:1.3.903 (1101:100:11w:500:3:2:103:aa)
macro_outdoor_dist-8.1.0(v3_1_0) DN:1.3.409 (N/A)... (3 Replies)