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

1
vote
1answer
39 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
296 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
44 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
148 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
192 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
125 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
90 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
411 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
50 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
28 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
24 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
288 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
1k 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
80 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
90 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
82 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
32 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
33 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
94 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
104 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; ...
1
vote
2answers
70 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
531 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
50 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
136 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
274 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
59 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
95 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, ...
4
votes
7answers
274 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
826 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
1k 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
587 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
127 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
366 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
66 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
75 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, ...
2
votes
2answers
328 views

Delete blank columns

This must be a common problem, but I couldn't find a solution. I have several files which have different sets of columns which are completely blank (for all rows except header) , how can I delete ...
1
vote
2answers
94 views

Regex for surrounding every word that contains & with $…$

I am thinking what is a robust approach for this. I try to match unsuccessfully by: [A-Za-z]*&[A-Za-z]* Which returns: so the mistake in \\&\hskip environment. How can you match ...
0
votes
3answers
239 views

awk or sed or perl: remove only characters on specific position

I have multiple files to rename leng-1494-001 leng-1464-002 leng-2414-004 leng-7894-005 leng-1323-006 I want to rename it ferr-1494-001 ferr-1464-002 ferr-2414-004 ...
0
votes
0answers
133 views

Compilation fails with Padre (a Perl IDE) on RHEL-based distros (CentOS, etc.)

I tried but failed (wxWidgets is a requirement of Padre) as root: yum install cpan perl-ExtUtils-Embed make gcc g++ wxGTK-devel.x86_64 # done, OK cpan YAML # done, OK and the problem: ...
0
votes
1answer
256 views

Comparing two text files and printing out matching ids, sub_ids and timestamp related to the id

I found this solution in Perl interesting. I have a similar situation to print matching columns and two additional columns from the second file (Rev ID n date released). How do I read both files from ...
5
votes
1answer
101 views

What are the 'n', 'l', '3pm' sections of the manual for?

An excerpt from the man man page: The default action is to search in all of the available sections following a pre-defined order ("1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7" by default) What are ...
2
votes
1answer
53 views

Adding consecutive characters to duplicate words according to order they appear

So I have files like this but for hundreds of different genes per file. >lcl|accession_cds_proteinaccession [gene=dnaA] [protein=description] [protein_id=accession] [location=location] ...
2
votes
1answer
3k views

Perl /Sed replacement

Below command is used to replace the password in a script but the perl command is adding a white space when it does the subsstitution password=arche20 perl -i -p -e "s/^(password[]*=[ ]*).*$/\1 ...
1
vote
2answers
68 views

To Regex Pandoc Tables

Minimum Data to regex \documentclass{article} \begin{document} ------------------------------------------------------------- A B C D Header Aligned Aligned ...
1
vote
0answers
2k views

Installing custom RPM says “does not update installed package”

I've inherited some servers which have previously always had its software as custom compiled versions (apache, perl, mod_perl etc). I was thinking than rather than compile every time, it may be better ...
6
votes
1answer
4k views

Replace non-printable characters in perl and sed

I need to replace some non-printable characters with spaces in file. Specifically, all characters from 0x00 up to 0x1F, except 0x09 (TAB), 0x0A (new line), 0x0D (CR) Up until now, I just needed to ...
0
votes
3answers
36 views

To improve this regex about digit separation

Code m/([+-]?\d+\.\d+)[\s\t]+([+-]?\d+\.\d+)/ Data 22.585698 3601.767090 D:\measurements\LabCourse_2015\6\90deg\image0001_23_mT.png 20.051883 3580.268555 ...
1
vote
1answer
61 views

Synchronize columns of two matrices

Please guide on how to solve this problem. I have pairs of files which I need to modify so that they have the same common columns in the same sequence. If my files are File1 and File2 as follows ...