Can someone help with this PERL code; I am getting this error while running below code:
And this is the code:
Thanks
You are trying to run a Perl program as a shell script. Those errors are thrown by your shell.
Do the following:
(1) Find out the path of the "perl" interpreter on your system by using the "type" or "which" commands.
So, in my system, "perl" lies in "/usr/bin" directory.
(2) Add the shebang at the top of your Perl program, which is nothing by the characters "#!" followed by the path to perl. After adding it, your program should look like this:
Needless to say, you'd use the path to perl on your system.
(3) Finally, to run the program, feed it to the perl interpreter, like so -
Note that the shebang is not required if you are going to invoke your program using the "perl" interpreter, but it is a good practice. And so is the "-w" switch which prints warnings, if any.
On the other hand, if you want to run the Perl program without feeding it to the perl interpreter, then you need the shebang. And if you choose to go that way, then:
(a) keep the shebang
(b) make your file an executable:
(c) and then call it like you would an executable -
tyler_durden
This User Gave Thanks to durden_tyler For This Post:
I have 250 files that have 16 columns each - all numbered as follows stat.1000, stat.1001, stat.1002, stat.1003....stat.1250.
I would like to join all 250 of them together tail by tail as follows. For example
stat.1000
a b c
d e f
stat.1001
g h i
j k l
So that my output... (2 Replies)
Can someone help me to do the following
I have two files
file one
123456
789012
345678
901234
567890
file two
abcdef
ghklmn
opqrst
901234
567890
uvwxyz (1 Reply)
Hello,
I wrote a script and part of the script, I have a validation to check if the file has <EOF> on the last line of the
file. If it does not have a <EOF>, then a message has to be written to a log file.
the code snippet shown below works fine, but it writes the below message if the... (1 Reply)
How to tail -f real time file.
I want to tail file created last time.
The server is gen new file Always.
.
An example file.
-rw-r--r-- 1 shinnie tiituck 251M Oct 18 05:39 20111018_00.log
-rw-r--r-- 1 shinnie tiituck 251M Oct 18 11:18 20111018_01.log
-rw-r--r-- 1 shinnie tiituck... (3 Replies)
The below code works to tail client.log file. but I want to copy the output into an external file /home/tail.txt
Can anyone please help.
#!/opt/bin/perl -w
open my $pipe, "-|", "/usr/bin/tail", "/var/log/client.log" or die "could not start tail on /var/log/client.log : $!";
print while... (2 Replies)
Can any one please help why does tail -f does not work in the below code:
Thanks in advance.
#!/usr/bin/perl -w
my $path = "/home/cs/logs/";
my $log = "log.txt";
`cd $path`;
`tail -f $log`; (3 Replies)
Hi All,
How I will read the output of the tail -F command in perl.
I have text file with below contains
file1.txt
1
2
3
4
$running=1;
sub openLog($)
{
(my $log) = @_; (1 Reply)
Hi All..
I have a log file in which all the backup information is stored. Now i have written a script which get the last line in the backup log file..
ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log"
However i would like to tail the line last... (4 Replies)
hi
we have 3 servers and we have a script to monitor cpu usage of all 3 servers and writes into one file on one of the server where we monitor all those servers ( by doing tail -f filename ) so we decided to create script ( perl ) that will read values from this file and display it should be like... (2 Replies)
Is there some way I can have a script monitor the newest line of a log file until a certain entry gets placed in the log?
Basically I want to start this script, and have it spit up the last 10 lines or so to a browser via AJAX... the AJAX is not my problem though, as I have no idea how to go... (4 Replies)