I just made a script to grab links from a website, and in turn saves them into a text file.
Now I'm working on my regexes so it will grab links which contains php?dl= in the url from the text file:
E.g.: www.example.com/site/admin/a_files.php?dl=33931
Its pretty much the address you get when you hover over the dl button on the site...
What is difference between if (%hash) and if (defined %hash)?
my %hash ;
if ( %hash) {
print "defined ";
}
if (defined %hash) {
print "defined ";
}
...
i have two text files
file 1
number,name,account id,vv,sfee,dac acc,TDID
7000,john,2,0,0,1,6
7001,elen,2,0,0,1,7
7002,sami,2,0,0,1,6
7003,mike,1,0,0,2,1
8001,nike,1,2,4,1,8
8002,paul,2,0,0,2,7
file 2
number,account id,dac acc,TDID
7000,2,1,6
7001,2,1,7
7002,2,1,6
7003,1,2,1
i want to compare those two text files. if the four col...
Hi ,
I have a file with the following entries
--INFO----- Command processing: Name='shayam' Age='19' Project='Alwa'
--ERROR---- Failed to process
--INFO----- Command processing: Name='ram' Age='23' Project='Alwa'
--INFO----- Command processing: Name='raja' Age='24' Project='Alwa'
--INFO----- Command processing: Name='shyla' Ag...
I want a Perl script to check a certain PID every couple of minutes and then kill the process. How do I wait those couple of minutes?
Thanks.
...
I am trying to cut down the number of ports printed in this list:
A.B.C.D 80,280,443,515,631,7627,9100,14000
to the ones that are most interesting for me:
A.B.C.D 80,515,9100
To do this, I am using this bit of code:
foreach (@ips_sorted) {
print "$_\t";
my $hostz = $np->get_host($_);
my $port = 0;
my $output = ...
Possible Duplicate:
How to convert a column number (eg. 127) into an excel column (eg. AA)
How convert number to base26 column string for excel. lang perl
...
I previously used to copy Python/Perl scripts to access from my bash script. Duplication is not a good idea I know! Is there a way to call them from bin or libs folder that we have set up?
For instance :
My python script resides in /home/ThinkCode/libs/python/script.py
My bash script resides in /home/ThinkCode/NewProcess/ProjectA/run...
I am trying to find a RSS parser that can be used with a Perl CGI script. I found simplepie and that's really easy parser to use in PHP scripting. Unfortunately that doesn't work with a Perl CGI script. Please let me know if there is anything that's easy to use like simplepie.
I came across this one RssDisplay but I am not sure about th...
I'm doing a script that enters a page and extract and extract information from it.
The script I'm doing it in Perl.
Problem: Not how to start running the script because when I start it picks up the url like this and this is not what I want
<a href="http://valeptr.com/scripts/runner.php?BA=6672&amp;hash=08c5c66839a468a11b7574e6ce02e...
Something like:
my %options = (
debug => 1,
options => ["ConnectTimeout 3","StrictHostKeyChecking no",],
);
# Making an ssh connection with user-password authentication
# 1) construct the object
my $ssh = Net::SSH::Expect->new (
host => $address,
password=> 'password',
user => 'admin',
raw_pty => 1,
log...
So far, I have some working code that goes into a list of servers and does some regex to grab data from a log file. What I want to do is to pring out a status of "NOTHING TO REPORT FOR THIS SERVER" if there is NO data to capture from the regex on a particular server.
Right now, it goes through each server and if data matches the regex,...
I have the below "system command" for moving the file. Is it good to use File::Move command or the use the below one. In case if File::Move is better, how can I use it?
system("mv $LOGPATH/test/work/LOGFILE $LOGPATH/test/done/$LOGFILE") == 0
or WriteLog(ERROR, "mv command Failed $LOGPATH/test/work/$LOGFILE status was $?");
...
I have updated my code to look like this. When i run it though it says it cannot find the specified link. Also what is a good way to test that it is indeed connecting to the page?
#!/usr/bin/perl -w
use strict;
use LWP;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new();
my $browser = LWP::UserAgent->new;
$browser->credentials(
...
I have a array that contains string which may contain whitespaces appended to the end. I need to remove those spaces using perl script. my array will look like this
@array = ("shayam "," Ram "," 24.0 ");
I need the output as
@array = ("shayam","Ram","24.0");
I tried with chomp (@array). It is not working with the s...
I am trying to edit a bugzilla page and was going to use template toolkit (on windows) for this as I am making quite a few changes. I am new to perl and template toolkit. I have looked at the manuals and tutorials for template toolkit but I seem to be missing the initial step. i.e. how to open an existing file for example "create.html.tm...
I have a Perl script which performs some tasks, one of which is to call a system command to "tar -cvf file.tar.....".
This can often take some time so I'd like the command line to echo back a progress indicator, something like a # echoing back to screen whilst the system call is in progress.
I've been doing some digging around and stum...
Hello,
I need to translate this piece of code from Perl to Lua
open(FILE, '/proc/meminfo');
while(<FILE>)
{
if (m/MemTotal/)
{
$mem = $_;
$mem =~ s/.*:(.*)/$1/;
}
elseif (m/MemFree/)
{
$memfree = $_;
$memfree =~ s/.*:(.*)/$1/;
}
}
close(FILE);
So far I've written ...
I am trying to get the background the standard terminal color instead of black but I can't seem to figure it out. When I use use_default_colors() the standards is just like not using colors but I would like to change the foreground color and not the background color. I use init_color_pair(1, COLOR_RED, COLOR_BLACK); but that gives me a b...
Trying to get a simple test perl script working. Have the following files/folder structure on a shared hosting service:
~/public_html/
.htaccess
~/public_html/lookup Permissions: "drwxrwxrwx 2 myusername myusername"
.htaccess
lookup.pl* Permissions: "-rwxr-xr-x myusername myusername"
The first .h...