Hello All,
i would like to start ping command and the result should contain also Timestate.
this i'm able to do with following command :
Code:
ping HOSTNAME | perl -nle 'print scalar(localtime), " ", $_'
or
Code:
ping HOSTNAME | awk '/time\=([0-9]+\.[0-9]{2}) ms /^[0-9]+ bytes from / { "date" | getline pong; close("date"); print pong":",$0; }'
sdcprd@dotstoas110:$ echo $F2
1327332411
this works
----------
sdcprd@dotstoas110:$ perl -MPOSIX -le 'print strftime ("%m%d%y",localtime (1327332411))'
012312 <<<< correct date
this doesnt
-----------
sdcprd@dotstoas110:$ perl -MPOSIX -le 'print strftime ("%m%d%y",localtime ($F2))'
123169
sdcprd@dotstoas110:$ perl -MPOSIX -le 'print strftime ("%m%d%y&
Hi,
i want to create perl script to telnet and print the output.
Hello,
I'm trying to figure out why this perl command does not work.
Hi Folks,
I have 2 perl scripts and I need to execute 2nd perl script from the 1st perl script in WINDOWS.
In the 1st perl script that I had, I am calling the 2nd script
main.pl
===========
print "This is my main script\n";
`perl C:\\Users\\sripathg\\Desktop\\scripts\\hi.pl`;
hi.pl ( this script I am calling from the firstperlscript.pl)
====
#!perl -w
print "hii Gir
Hi,
I am trying with the below Perl command to print the first field when the second field matches the given pattern:
Code:
perl -lane 'open F, "< myfile"; for $i (<F>) {chomp $i; if ($F[1] =~ /patt$/) {my $f = (split(" ", $i))[0]; print "$f";}} close F' dummy_file
I know I can achieve the same with the following thread: http://www.unix.com/shell-progr
Code:
perl -e '@stat=stat("/etc/passwd");$now_string=localtime($stat[9]);print $ARGV[0].":$now_string\n"' ./file_name
Please if anyone can describe it.
Thanks in advance
I want to check access rights permissions not for 'user', not for 'group', but for 'others'.
I want to do it by system command in which i want to use 'ls -l' and 'awk' command.
I have written the following program :
#!/usr/bin/local/perl
#include <stdlib.h>
system ("ls -l | awk '/^-......r../ {print $9 " is readable for others}' ");
system ("ls -l | awk '/^-.......w.
here's a very simple script:
[root@poker cgi-bin]# cat globtest.pl
!/usr/bin/perl -w
my $foo="/tmp/*";
my @glob=glob($foo);
my $size=scalar(@glob);
print "Content-type: text/html\n\n";
print "\n";
print "SIZE: $size\n";
print"\n";
when I run it from a URL on a RHEL5.3 system, it tells me how many files are in /tmp, but when I run it on a RHEL 6.2 box it reports 0.
what gives?