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 ...

learn more… | top users | synonyms

0
votes
3answers
62 views

Null value than rename file

I have a shell to a task but I should handle the null value in this. So in the task i cut the part of a word and i delete or rename the file, but need another if element for null. For example: I ...
2
votes
1answer
74 views

Perl Error “Can't locate Thread/Pool/Simple.pm in @INC”

Can someone help me with this error? I've upgraded my MAC OS to Yosemite 10.10.5 and seeing this issue since. Can't locate Thread/Pool/Simple.pm in @INC (you may need to install the ...
1
vote
1answer
64 views

Print attributes from two tags together

I am using XML:twig to extract some attributes from an XML file using Perl; Here is my code: use XML::Twig; my $file = $ARGV[0]; $file =~ /(.+)\.xml/; my $outfile = $1.".snp" ; open my ...
1
vote
1answer
32 views

conditional coloring using perl expression

I have two commands in perl and one test file test.txt: $ cat test.txt aaa bla bbb foo #ccc bar ddd 444 First perl expression colorizes any occurrence of aaa or bbb with red color: cat test.txt | ...
0
votes
3answers
81 views

Problems with a perl script that should remove strings in the lines of one file from another file

I have a file ~/foo and another file ~/remove.txt. I would like to write a perl script that loops over every line of ~/remove.txt and removes every instance of the string (<LINE>) from ~/foo ...
1
vote
3answers
110 views

Remove comma from columns in a file if it is at the end

I have a tab separated file contain 19 columns, some of these columns contain comma at the end. I want to removed these comma from all columns if it is at the end. Example: c1 c2 c3 c4 c5 ...
2
votes
2answers
290 views

alter a line and remove tag using perl from xml file?

I have an xml file (client_23.xml) in which I need to alter one line and remove one whole tag from it so I came up with perl script: In my xml file, I have a block like this. There will be only one ...
1
vote
2answers
280 views

Parse XML file to copy the content into another file at a particular spot in the file?

I have an xml file (client_23.xml) in which I need to add few lines at a particular section basis on what is there in other xml file (abc_lop.xml). Here is my abc_lop.xml file in which you see I have ...
10
votes
1answer
280 views

What's with all the renames?

On my Debian system (well, my LMDE system, but close enough), I have at least 3 different rename programs: /usr/local/bin/rename : This is a Perl script, written by Tom Christiansen. Oddly enough, I ...
2
votes
1answer
61 views

Meaning of this character class in perl?

I am new with PERL(though I have good background in reg-ex), I was going through one perl script and it has one characters class $alwayssep = "[\\?!()\";/\\|‘]"; Can anyone explain to me what is ...
0
votes
2answers
62 views

Taking numbers from a text file and add them together

I have text file with hundreds of lines like below. I am trying to find a way to pull the number of records and add them together. Then I want to put the answer in a separate file This is my first ...
1
vote
4answers
147 views

Replacing a “time” column with corresponding values

I have a file in the following format: "2004-04-19 12:25:57" 44 44 "2004-04-19 13:39:32" 36 36 "2004-04-19 14:00:53" 34 34 I need 2 new files: a) A file which will replace "time" values of the ...
1
vote
2answers
60 views

Execute Perl commands from a specific IP?

I have a Debian Jessie 8 server with three unique IPv4 IPs. I connect to the server from Windows 7 via Putty. I can open three Putty windows using each of the three IPs. I am trying to execute a Perl ...
1
vote
5answers
78 views

Making a *nicely* formatted list of number of files in directories - awk & sed probably

I have lots and lots of files in a series of directories, and would like a nicely formatted list of how many files are in each directory. The directories are ordered thus: Parent directories named ...
2
votes
1answer
82 views

Why isn't rxvt-unicode launching with perl extensions enabled by default even though I built it with '--enable-perl' and even '--enable-everything'?

I'm trying to get 'clipboard' perl extension for urxvt to work. I installed the script, it didn't work, and after some searching around I discovered that Cygwin's rxvt-unicode package is built with ...
1
vote
2answers
23 views

Perl script in bin that calls a file

I have a script ~/bin/script $ cat ~/bin/script #!/bin/bash perl -pe 's/loremipsum/`cat ~/foo/bar/file.txt`/ge' -i ~/path/to/target.txt The script is supposed to replace every instance of ...
1
vote
1answer
123 views

Script to remove certain span elements from an HTML file

I want to write a script that completely removes every instance of a particular span class from a given HTML file. For example, if my undesired span class is "foo" then running my script on the file ...
0
votes
1answer
47 views

Perl one-liner to replace a code block

I have a file foo.txt hello world first line to change second line to change I would like to write a perl one-liner that changes foo.txt to read hello world this is my ...
0
votes
2answers
40 views

Breaking up a file into two parts based on a particular line [duplicate]

I need to breakup a file into two separate files based on a particular line for example: . . sc_outfifo 0.000E+00 0.000E+00 0.000E+00 0.000E+00 1.586E-02 1.586E-02 1.586E-02 Fub_Level_DACGE(%) ...
1
vote
2answers
1k views

perl library getopts.pl

I'm trying to install a program, but keeps giving an error saying it doesn't find the perl library getopts.pl. My perl version is v5.16.2. The error message is: Can't locate getopts.pl in @INC ...
1
vote
2answers
327 views

Script that only counts Established, TIME_WAIT, and Closed Wait connections using Netstat

I'm trying to make a script (using Perl, but it isn't necessary) that will only count the number of Established, Time_Wait, and Closed_Wait connections on a system and print them in terminal. So far ...
0
votes
1answer
612 views

Bash will not execute system command in Perl script

Need a Bash file to run a perl script. This is the Perl file. #!/usr/bin/perl -w use strict; system "fastacmd -s $Q -d $NewQuery -o ./gifiles/$Q.$NewQuery.txt"; I have left alot out to avoid ...
3
votes
0answers
85 views

apt-get upgrade with /usr/bin on aufs fails to create backup link

I'm trying to update a frugal persistent (root and home) install of antiX-15 x64 from stable to testing. I changed the source lists and ran apt-get update. apt-get upgrade then fails with the ...
1
vote
1answer
49 views

add pairwise values looking up from a file

I have several variables (col1) which have 3 values (col 3,4,5) for some levels (col2) mango123 L1 1 2 3 mango123 L2 4 5 6 squash378 L1 7 8 9 squash378 L5 10 12 13 squash378 L15 0 1 3 ...
1
vote
0answers
178 views

Daemonize a perl script at startup Linux

I have a custom version of CENTOS that I need to run a perl script as a daemon in at all times. To do this I want to get it to run on startup as a daemon. When the machine is on I can daemonize the ...
0
votes
2answers
2k views

How to detect and remove newline character within a column in a csv file?

I have a large (2 Million rows) csv file exported from a SQL Server database. I don't have access to the database, and there's some newline character within a column, which makes it difficult to ...
-1
votes
2answers
109 views

How to remove line break if line character count less than n chars [closed]

Could anyone help me to concatenate the line with next line if the line char count is less than x chars.
0
votes
1answer
65 views

Search script ignores robots.txt

I am using Perfect search and it seems to ignore the robots.txt file. Any ideas what's wrong? I get the same error message. I need 10 reputation points to post more than 2 links. So I'll make note ...
3
votes
2answers
1k views

Using bash variables in perl command in bash script

I am trying to generate a hashed password as in /etc/shadow file, using bash script. The user is prompted for the password which is saved in a variable PSWD. I have extracted the Hash and the salt ...
0
votes
0answers
109 views

Problem accessing robots.txt from search script

I have been using the Perlfect Search Script http://www.perlfect.com/freescripts/search/ for several years on my sites. For reasons unknown it stopped working properly a few months ago. When I run the ...
0
votes
0answers
78 views

Drawing a histogram from a bash command output

I have the following output from a miRNA Predictor: Read Sequence:hsa-miR-576-3p MIMAT0004796 (22 nt) Read Sequence:gi|182396|gb|M74088.1|HUMFAPAPC Human APC gene mRNA, complete cds (8972 nt) ...
2
votes
2answers
56 views

Grouping lines into heterogeneous subsets

I have file with n lines.  (Each line refers to a “question”, and therefore they are labeled Q.1, Q.2, Q.3, ..., Q.n.)  Each line (question) has a “Marks” attribute, which has the value 2, 3, 4, 5, or ...
2
votes
5answers
516 views

Perl script to compare two consecutive lines for the first character and ignore the second line if both first characters are same

Can anyone help how to compare two consecutive lines from a text file for the first character and if both the first characters are same ignore/delete the second line and print into new file only the ...
2
votes
1answer
39 views

String concatenate in perl?

I apologize if this question is too basic, but I'm really very very new to perl. Now I want to write the following two lines of code in one line: perl -e 'print crypt("my_password","\$6\$my_salt\$")' ...
-1
votes
1answer
48 views

modify perl output [closed]

currently I have the following script #!/usr/bin/env perl use strict; use warnings; my %seen; my $header = <> . <>; print $header; my $last_sequence_number = 0; open( my $output, ...
1
vote
2answers
150 views

How do i have my script execute one more command after a previous command returns a non-zero value before it is aborted?

I have a shell script that calls on a Perl script to do some file processing. The Perl scripts exits with either a zero or one value. I have the Unix set -e command at the beginning of my script to ...
1
vote
2answers
215 views

how to replace a sed/perl expression (change and print only matched line) with a python expression?

I have asked this question to learn how perl could replace sed. Now I want to know how the following commands (which do the same thing) would look like for python: sed -n ...
1
vote
2answers
102 views

how to replace a sed expression (change and print only matched line) with a perl expression?

I am trying to move to perl (from sed). But how can I replace this sed expression with perl in a similarly short way? sed -n '/patternmatch/s%stuff%changed%p' file I need to search for a pattern, ...
0
votes
0answers
41 views

How to run Padre after installing via cpanm?

./cpanm Padre It looks like I could successfully install Padre. But.. How can I start it? I installed it with a normal user, not root.. where is the start script? [user@notebook ~]$ find . -type f ...
1
vote
1answer
38 views

detect interface name with perl

I want to detect the interface name (can't use udev because of hardware reasons) and do things according to it. Basically this should be a first check if the wifi device is able to "see" anything. ...
2
votes
3answers
272 views

compare multiple files(more than two) with two different columns

I have four different files: file1, file2, file3, file4. Each file has 2 different columns separated by tab. I want to match first column of file1 (as reference) with the first column of second file, ...
-3
votes
2answers
43 views

upload images in tomcat server [closed]

I am facing image upload issue in tomcat server outside the war file. My image location is /home/username/tomcat-images.and what is the url of to access images in web browser.
4
votes
3answers
146 views

Undo letterspacing with sed

I have a source text file containing text where some words are l e t t e r s p a c e d like the word "letterspaced" in this question (i.e., there is a space character between the letters of the word. ...
-2
votes
1answer
179 views

linux shell command in Perl program

Hi friends here is some issue I want to write a script that restarts server which is in stopped status. Here I am using my MySQL server in future if it is in stopped status then it will be restarted ...
2
votes
2answers
63 views

Truncate the third column until given strings

INPUT: W41784094 CH60104475 lasbalsrbla bla foo bar bla PT~CH60104475 W41788464 WO60444453 hellobla bla -bla foo bar 432 alaf. PT~CH60107925 W41753387 IN61026681 sim##bla-bla bla foo bar ...
0
votes
1answer
118 views

Python output in XML format

I have a python script which compare IP list with IP Database and gives output of matching criteria. (I got the script from this forum). convert.py #!/usr/bin/python import socket,struct ...
0
votes
2answers
89 views

get values which only occur once in a vector

There is a vector of numbers I have which are in ascending order (it is called t8_) 2 7 8 9 11 15 34 91 91 92 94 The problem is that some numbers happen two times. I don't want to remove them, but ...
1
vote
1answer
88 views

Impute data by majority value per group

I have instruments in col1, their variables in col2 and calls in col3. In this example, there are 17 INS and 3 M types. Potentially there will be 17 x 3 rows. But some are missing. INS1 M1 AA ...
3
votes
5answers
389 views

How to add column in the beginning of file using perl?

I want a Perl one-liner that checks whether the first fields of an input file is the file's name and, if it isn't, adds the file name as the first column on every line. Example written in shell : ...
0
votes
1answer
48 views

How remove duplicates in same file and with if condition?

INPUT FILE: has all these values without header: customer ID, code, start_date, end_date 124343, DCW, 2015-07-06, 2016-08-03 235432, ABC, 2015-04-26, NULL 235432, ABC, ...