Perl is a high-level, general-purpose, interpreted, dynamic programming language. It was originally developed by Larry Wall as a general-purpose Unix scripting language to make report processing easier, over a period with support from open source community, it has evolved and matured to be used for ...
0
votes
1answer
613 views
Manually assign a value when inet_ntoa does return an ip address
Code:
foreach $hostname (@hostnameUniqueSorted){
$ipaddr = inet_ntoa((gethostbyname($hostname))[4]);
if(chomp($ipaddr) =~ '^$') $ipaddr == "ip not avail"; <-- doesn't work
}
If the ...
1
vote
1answer
10 views
How to mention rpm to look for dependent perl modules in the system
By default rpm looks for the perl modules inside the rpm itself and throws dependency error if it is not found.
For eg., I have a perl script in the rpm that uses Crypt::DES perl module.
I have that ...
2
votes
2answers
37 views
When Adding IPs with ifconfig eth:xx, how do I in one line find the highest eth:xx
This will be in a Perl script I need to grab that number and increment it by one for the new IPs. Any one have a one liner for me? Can be Bash/Perl.
edit
Given the following input.
inet ...
3
votes
2answers
87 views
find files not matching list of filename patterns
I find myself needing to find and identify extraneous files (out of about 900K files on a 2T drive). There are lots of files that I want to keep, and I have filename patterns for these known good ...
2
votes
1answer
59 views
Why the order of wildcard results might be different when used from the terminal or from perl?
There's a folder with a bunch of files and a perl scrip that lists them using ls with a wildcard like:
#!/usr/bin/perl
system("ls -U -1 dir/*");
I noticed that if I run exactly the same command ...
1
vote
1answer
38 views
How to safely move a file to another directory and remove duplicates
I want to move files from Downloads, Documents, Pictures, Music, et al to shared locations. This is for various reasons, including because I want to keep media in a central, shared place.
I want to ...
0
votes
2answers
688 views
Failed dependencies trying to install package 'libxml2'
I am trying to install libxml2, but my system complains about dependencies. The dependent packages exist on system.
The ultimate goal is to install xml_grep2, I have been trying various methods ...
-1
votes
0answers
26 views
How to add a line-break to a Perl script print [migrated]
I'm having an issue with a basic perl script. Below is the script.
$message = "Hello, World!";
print $message;
The problem is that it prints then on the same line has my username command prompt. ...
1
vote
2answers
42 views
Why `rename` behaves differently whenever I use full path instead current path?
Ok, I'm answering a question where the OP have several repositories in Ubuntu that might be causing a problem installing unrelated software. I recommend disabling the PPA's using a single liner rename ...
1
vote
1answer
59 views
Parsing the headers of sequence file
I have a multiple sequence file as
>abc|d017961
sequence1......
>cdf|rhtdm9
sequence2......
>ijm|smthr12
sequence3......
>abc|d011wejr
sequence4......
>stg|eethwe77
sequence5......
...
1
vote
1answer
36 views
how to clean free row/column spaces after the row of your data
I have a problem in cleaning my file where there are unnecessary free spaces below my last data row. This is created when I am copying and pasting my data from excel to text. I want my text file to ...
0
votes
2answers
60 views
How to write a job in Perl?
I have had very minimal experience in writing jobs. A long time ago, i had written a very small simple java job for reading and writing files using tasklet in java. Now I have to learn how to write ...
1
vote
2answers
69 views
squid access.log delete entries older than 6 months
Squid generates a log of the accessed sites by the users.
I want to delete the entries in the /var/squid/logs/access.log, which are older than 6 months.
I would execute the script each week. I have ...
4
votes
6answers
82 views
Only show the lines that are in all textfiles at least once
a.txt
cat a.txt
a
b
x
c
b.txt
cat b.txt
d
e
a
f
the q:
SOMEMAGICK *.txt
a
Q: how can I show only the lines that are in all *.txt files?
1
vote
3answers
96 views
How to convert from one date format to other format?
I have one problem with my date format. I want to change from one format to the other and vice versa. My date formats are
Format 1
YYYY-MM-DD
Format 2
MM/DD/YYYY
I want to change format 1 to ...