I don't understand this. I have a text file I am trying to do a substitution for that is not working:
#!/usr/bin/perl
my $out_file = "/etc/default/ovpa";
open (OUT, "$out_file") or die ("Error opening ovpa file $1");
while(<OUT>) {
chomp;
s/MWA_PROTOCOL/IT WORKED/g;
}
Here is the file...
Hello all,
I have a program that basically does an FTP get of a file from a server, deletes some stuff from the file and then does an FTP put to another server.
My script is working correctly but I would like to be able to print the FTP debug output to a logfile. Here is one of the FTP...
Hello all,
I have a script that uses the Net::FTP module to do some gets and puts. The gets are working fine but the puts are hanging. Here is the debug output:
FTP Debug output:
Net::FTP=GLOB(0x403fdb54)<<< 220 Microsoft FTP Service
Net::FTP=GLOB(0x403fdb54)>>> user massmutual\weblog...
Hello all,
Below is a snippet of code I am working on.
use strict;
open (PREFIX, "/home/mt71124/scripts/tws_prefix.txt") or die ("Error opening prefix file: $?");
my ($cpu, $sched_name, $job_name ) = @ARGV;
my $count = scalar(@ARGV);
chomp ($cpu,$sched_name,$job_name);
my $prefix;
print...
Hello all,
I am trying to get a script to work that I did not write. It looks like it should be working:
#________________________________________________________________________
# Program: CPU3_check
#
# This script checks the CPU utilization of a system against
# a predetermined threshold...
Hello all,
I have a script I am working on that looks to me like it should be working but it does not. It takes 4 variables from the command line, opens up a config file and compares the command line args against the config file:
use strict;
use warnings;
my $prefix = shift @ARGV;
my $cpu...
I have the following code that is not working. The problem seems to be with what I am redefining the default record separator to. I know I have done this before in a while loop to change the scope of what a record is defined as. Any help is appriciated.
use strict;
use warnings;
my $prefix =...
Hello all,
I have many text files I need to add a line at a certain point. A sample of the file is below:
SYNTAX_VERSION 7
LOGFILE "ADSM/AIX logs"
DESCRIPTION "ADSM backup message log on AIX"
LOGPATH "/usr/lpp/adsm/bin/dsmsched.log"
INTERVAL "15m"
CHSET...
I am using the standard Net::FTP code in a subroutine as in below:
sub GetFTP
{
##########################################################################################
#
# This subroutine performs an FTP Get using the Net::FTP module
#...
Hello all,
I am writing a script that (in part) opens a file for reading and writing, loops through the file line by line looking for a specific strings. If it finds any of the strings I want to delete the line and go to the next line in the file (while loop).
Here is what I have so far:
my...
Hello all,
I have a script where I am running a very large text file being writen into an array. The seven element of that array is a hostname. There are many entries with the same hostname in the file. I want to count the occurances of each hostname and end up with an output like:
hostname1...
Hello all,
I am using the Crypt::CBC module to encrypt and decrypt some text files. I am using Blowfish encryption with CBC. When I run my program it can't seem to find the Crypt::Blowfish module.
Here is the error:
Couldn't load Crypt::Blowfish: Can't locate loadable object for module...
Anyone have any sample code for using Net:SSH to connect to and run a sho command?
Net:SSH does not seem to have a way to pass a password to log in and expects a certificate. On my test router I SSH to it and it asks me for a username and password so I do not think Net:SSH will work. I also...
Hello all,
I am writing a perl script a part of which is to SSH to a router, run a show command and capture the STDOUT of the command. Can I do this with a shell command?
I have tried:
my $password = 'password';
my $user = 'auser';
my $ip = '100.152.201.22';
my $results=`"(echo $password) |...
Hello all,
I have just been informed that at this site I cannot install any libraries or modules n production systems under the /usr directory. I have been told that folks before have modified the Makefile.PL for the modules to specify a different directory such as one created under /opt/app...
Hello all,
My question is say I have die code like:
[code]
open (LOG, ">$log_file") or die ("Error opening log file $1");
or
die $sth->errstr if $sth->err;
or
$scp->cwd("/tmp") or die $scp->{errstr};
[/code}
How do I write the "die" output to a file handle instead of STDERR or both...
Hello all,
I got the following code of another post:
use strict;
use warnings;
use Crypt::CBC;
use FileHandle;
Encrypt();
Decrypt();
sub Encrypt {
open(CT,">ct.dat");
open(PT,"<pt.txt");
my $cipher = new Crypt::CBC({'key' => 't1234',
'cipher' => 'Blowfish'...
Hello all,
I am working on a script that reads a config file and loads it into a HoH as below:
open (CFG, "$cfg_file") or die ("Error opening config file $cfg_file: $1");
#
# Read config file, load a Vendor => Device Type => CLI hash of hashes. Count the entries.
#
my %cmd;
my ($vendor...
I found another thread much like mine
thread219-451673
but I am not sure how to "break up my statement". This SQL query was given to me to run in my script. Any ideas how to fix this?
my $sth = $dbh->prepare( q{select T1.SVALUE, T2.SVALUE, T3.SVALUE from twtpropvalues T1, twtpropvalues T2...
Hello all,
I have the following config file I nees to load in a way that I can easily access the commands:
#
#
# Vendor Device Commands
#
Foundry& IMG& show ip nat statistics,sho server sessions, , , , , , , ,
Foundry& DLB& sho server sessions, , , , , , , , ,
Cisco& BSR& , ,sho idb, ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.