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
1answer
11 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 ...
1
vote
0answers
28 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
40 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
160 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
27 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
27 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
23 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
82 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
1answer
72 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 The only way I could do it was ...
0
votes
0answers
5 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
0answers
26 views

Squid JavaScript injection problem [closed]

I got Squid up and running on my Debian machine. I tried connecting and it works, but the url_rewrite_program function does not work! Here is my Perl script: #!/usr/bin/perl $|=1; $count = 0; ...
1
vote
0answers
14 views

How can I fix these failed perl tests? [migrated]

I'm attempting to build perl 5.16.3. However, it's failing at the make test part. Failed 2 tests out of 2246, 99.91% okay. ../cpan/Archive-Extract/t/01_Archive-Extract.t ../lib/h2ph.t ### ...
1
vote
1answer
25 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. ...
1
vote
3answers
46 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
26 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.
3
votes
3answers
122 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
46 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
52 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
44 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
0answers
14 views

I have two arrays roles added and roles deleted, want to merge them and write in this order in perl [migrated]

I have another scenario. My file has the following fields: Username | Roles | Type |date | abc|admin |added | 01072015 abc|developer |deleted |01072015 abc|deploy |added |01072015 xyz |admin |deleted ...
0
votes
2answers
76 views

get values which only ocurre once in the vector

there is a vector of numbers I have which ascend (it is called t8_) 2 7 8 9 11 15 34 91 91 92 94 the problem is that some number happen two times - I don't want to remove them but they have to ...
1
vote
1answer
80 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
126 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
40 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, ...
1
vote
1answer
22 views

calculate numbers on end and merge to one line

So in a file i have lines like these: thisdata:thisother:1337 thisdata:thisother:1800 thisdata:thisother:1500 thisdata:thisother:46984 I would like to output: thisdata:thisother:51621 for all ...
-1
votes
1answer
19 views

Matching 2 different files by first column

So I have 2 different files. file1.txt is: abcdefjeiireiiioe:data:otherdata rijirjeiwrieeoooe:datamore:otherdatamore file2.txt is: abcdefjeiireiiioe:data:otherotherdata ...
6
votes
1answer
109 views

How can I extract/change lines in a text file whose data are separated into fields?

How can I manipulate field-based data from the commandline? For example How can I print only lines whose Nth field is foo? How can I print only lines whose Nth field isn't foo? How can I print only ...
0
votes
2answers
52 views

Installing perl modules

I was trying to install a perl module Future::Utils on my Ubuntu machine but didn't find the exact command. I tried this command but it didn't work: sudo apt-get install libfuture-utils-perl I have ...
0
votes
2answers
59 views

Find all characters “[1-777])” at the beginning of the line

Pseudocommand perl -pe 'g/^[1-777])/g' data.txt where I try to all numbers at the beginning of a line with ")" following them etc 1), 67) and 777). Data where all question numbers should (etc 1), ...
-1
votes
2answers
65 views

To have strict and warnings in Perl oneliner [closed]

I really miss use strict; use warnings in my Perl one-liners such as: perl -ne 'print unless /[0-5],[0-5]?|hernia|.{170,}|benz/' file` especially when I include many conditions separated by |. I ...
1
vote
3answers
72 views

Match beginning of a line with something there?

I want to match the beginning of lines where the line contains something. Command in Perl/Sed 's/^.?/\section{}/g' but the problem here is that it replaces also the first character of sentences. ...
0
votes
1answer
31 views

Filter out combination options in lines

Data Life by cerebral flow is coming to:---1) Prolonged jumping rate---2) Small holiday course---3) Hello this world---4) Dance rock coffee---5) Therapy unproven---Choose right ...
1
vote
1answer
28 views

source file with keys and values and use it in perl code

I have a file like this saved as /var/ldt/ldt.conf : LDT_HWADDR='00:00:00:00:00:00' LDT_DISK='/dev/sda' LDT_OS_ID='24' LDT_VERBOSE=true RUN_UPDATES=true I want to source it in a way that in my perl ...
1
vote
2answers
51 views

shell or perl script to check group have read privileges

ls -l drwx------ 8 ws web 1024 Apr 29 2013 abc drwxr-xr-x 8 ws web 1024 Oct 19 2011 def I need some script to find directories like abc which doesn't have read/execute permissions ...
-3
votes
1answer
48 views

Peculiar error in perl Program [closed]

I have written this perl program to copy certain type of files . I see very annoying and peculiar error when I run this program. #!/usr/bin/perl -w use strict; for (my $LAMBDA=0; ...
2
votes
2answers
56 views

is it possible to search for files that have a special Linux file attribute?

is it possible to search file in the linux OS that have particular file attribute as this: ---S--l--- ---S--l--- 1 root root 0 Mar 1004:25/opt/csTuner/iba/wys/tuer_lolk What is S in ...
4
votes
5answers
373 views

How can I replace all semicolons after 1st one?

This problem is related to my attempt to import questions and their answers in a Excel file into .txt -file which Anki flashcard program handles as described here. I cannot have more than 2 fields so ...
1
vote
2answers
46 views

add ordering number to specific text

Is there any way to add a number into a specific text? On my text file: <a href="http://localhost/file1.txt">file </a> <a href="http://localhost/file2.txt">file </a> <a ...
1
vote
2answers
59 views

Count frequency of specific numbers in a text file of scientific notations

Background I have a text file, named blood_conc.txt as shown: 0, 0, 0, 0, 0, 0, 0, 1.32006590271e-05, 1.990014992001e-05, 1.504668143682e-05, 2.176900659261e-06, 7.673488970859e-06, ...
3
votes
4answers
87 views

To remove newlines after empty line

Data 4. Alendronic acid A. Antiosteoporotic agent. B. Inhibit osteoclast formation and function by inhibiting FPPS enzyme, so increase bone mass. C. Osteoporosis in combination with vitamin D. ...
-2
votes
1answer
54 views

Remove everything else after this mark?

Data C. Induction anesthesia, muscle relaxant, anxiolytics, 1st line sleeping disorder (but short time in market). \part{Theoretical Questions} Lorem Code cat ...
0
votes
1answer
48 views

Splitting a file using perl

I have a csv file and like to split the file into smaller files based on column matching in the file using perl. I am new to perl. I am working on Linux Rhel6. example: fruit1, ...
3
votes
7answers
147 views

Insert a word in the first line of the file

Input: firstline secondline thirdline ...some magic happens here... :) Output: insertedtextfirstline secondline thirdline Question: How can I insert the insertedtext to the start of the first ...
1
vote
1answer
79 views

How can I install all missing perl libraries?

I'm attempting to install logitechmediaserver 7.8.0 on my OSMC (Raspbmc) Raspberry Pi. I primarily followed instructions from here, although some of the install did not work (some dependencies missing ...
0
votes
1answer
90 views

AWStats on Debian Jessie Forbidden from Browser / Unresponsive from CLI

I asked this on SO a day or two ago and no response yet. Hoping for some insight here in getting AWStats configured and running on Debian Jessie. Installed AWStats with apt-get install awstats. No ...
5
votes
6answers
358 views

sed command to swap characters

My input file layout is: mm/dd/yyyy,hh:mm,other fields I need to format it as: yyyy-mm-dd hh:mm:00,other fields sample input: 01/02/1998,09:30,0.4571,0.4613,0.4529,0.4592,6042175 ...
1
vote
1answer
76 views

What sites can be added to toast?

I am using toast - packageless package manager because I have no root access. One of the sites toast looks up packages is the now defuct site freshmeat.net. I tried to add ...
3
votes
3answers
115 views

To replace % marks but not \% in Perl Regex

I am thinking how you can replace [^\]% marks but not \% marks in the sed -command of this answer. I think look-behind is not necessary. My current Sed command but I think Perl is a must here cat ...
0
votes
1answer
37 views

Using Perl to modify specified lines of an ASCII file

Background: (1) I have a data set of scientific notation: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.503832e-05, 1.433673e-05, 2.557402e-05, 3.081098e-05, 4.044465e-05, 2.480817e-05, 2.681778e-05, ...
2
votes
2answers
57 views

Add a number in a huge ASCII file

Background: (1) Here is a screen capture of a part of my ascii file (over 600Mb): (1.1) Here is a part of the code: 0, 0, 0, 0, 0, 0, 0, 0, 3.043678e-05, 3.661498e-05, 2.070347e-05, ...