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

2
votes
0answers
48 views

Organizing three dimensional data with awk/sed/perl

I have this file (a sparse matrix): PC.354 OTU1 6 PC.354 OTU2 1 PC.356 OTU0 4 PC.356 OTU2 7 PC.356 OTU3 3 I want an output like this (dense matrix -classic .biom table): OTU_ID PC.354 PC.355 ...
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 ...
3
votes
5answers
306 views

Increment index in file

Alright, it seems I cannot find a way to do what I need. Let's say I have a text file A like this (freqBiasL2[27]) (SatBiasL1[27]) (defSatBiasL2_L1[27]) (defSatBiasSlope[27]) ...
0
votes
2answers
20 views

Adding 'exception' words to the rule of perl matching titles script

I have been using this perl script (thanks to Jeff Schaller) to match 3 or more words in the title fields of two separate csv files as answered here: Matching 3 or more words from fields in separate ...
1
vote
1answer
33 views

timestamping history file causing erroneous lines in history command

I have .bash_profile setup to export to a history file: export HISTFILE=/root/history/.bash_hist-$(who -m | awk '{print $1}') Then I am exporting time stamps for the history command. export ...
4
votes
4answers
108 views

Replace strings in a file based on a list of strings and a list of corresponding replacements

I am trying to replace strings in a file A: Hello Peter, how is your dad? where is mom? where the strings to be replaced are in file B: Peter dad mom and their corresponding replacements are in ...
-3
votes
2answers
43 views

linux + convert file format columns to one column

I have the following file (Linux.txt) linux-test01 linuxER LinuxCV LinuxWE LinuxPL LinuxDF LinuxXC LinuxSD LinuxAQ how to print using awk or perl one-liner to produce the following ...
2
votes
3answers
189 views

sed regular expression behaving differently than in vim and perl?

Here's a sample 'test.txt' abcdX1yad45das abcdX2fad45das abcdX3had45das abcdX4wad45das abcdX5mad45das sample desired output: X1yad X2fad X3had X4wad X5mad I could get it working in vim with: :% ...
1
vote
0answers
16 views

MOZREPL output showing up in terminal window

I have a very a annoying problem. I've using Mac Terminal over SSH to write Perl script with vim on a local virtual Debian machine. The Perl script uses the WWW::Mechanize::Firefox module which in ...
1
vote
3answers
35 views

How to add the aggregated numbers in a file

I need to write a script which will add the values for the same string in different lines. For example when a file contains the following: abc,10 xyz,20, abc,30, ghd,40 xyz,10 script should check ...
0
votes
1answer
29 views

How to modify @INC in Perl

I am trying to install Perl from source (because my server isn't conected to internet), and while doing 'make install' .. it stops at: Can't locate DWIM.pm in @INC (you may need to install the DWIM ...
251
votes
6answers
482k views

How can I replace a string in a file(s)?

Replacing strings in files based on certain search criteria is a very common task. How can I replace string foo with bar in all files in the current directory? do the same recursively for sub ...
0
votes
1answer
21 views

Linux red hat + replace PATH or word on scripts

Under folder: /var/userTN/applo folder I have around ~100 shell scripts that include the following PATH: GLOBAL_PATH=/export/pop/PLW5 I want to replace the PATH on all the scripts under folder: ...
1
vote
1answer
3k views

“Requires: perl(:MODULE_COMPAT_5.8.8)”

I use CentOS 6.5 for my server with below repository: IUS epel ces-standard-* base/upgrade/extras When I tried to update today (it's been a while I haven't updated this server), I got the ...
3
votes
2answers
48 views

How to export a variable from a perl script into a shell script?

I have a shell script in which I am running perl script by below code. perl perlscript.pl In the perl script I have defined a variable called $circle. Now I want to use this variable value in my ...
1
vote
2answers
26 views

Perl script to split a file based on a pattern at a certain offset

I need your help to get an idea as to how to split a large file into small sub-files as said in the example below. Criteria is we are looking at offset 30 (31st bytes to 2 bytes). If the offset ...
0
votes
2answers
2k 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 ...
-4
votes
0answers
26 views

PERL SCRIPT ERROR (DBD ERROR: error possibly near <*> indicator atrror possibly near <*> indicator at char 53 in 'insert [migrated]

i am getting below error while running below perl script. Can any body help to figure it out` $ENV{PATH}= '/appl/OMS/scripts:/etc:/usr/bin:/usr/sbin:/b... $ENV{PATH}= ...
4
votes
1answer
378 views

How do I sort words by syllable count?

How do I perform an ascending sort of a word list, based upon how many syllables each word contains? Example Input: something important dog cat bookshelf Example Output: dog cat something ...
8
votes
6answers
12k views

How to grep for text in a file and display the paragraph that has the text?

Below is the text in the file: Pseudo name=Apple Code=42B state=fault Pseudo name=Prance Code=43B state=good I need to grep for "42B" and get the output from the above text like: Pseudo ...
0
votes
0answers
173 views

error for installing Math module CDF in perl

I am trying to install Math::CDF in perl I tried both cpan -i Math::CDP and install from downloaded files both end up in error after enter make install: Running make install make[1]: Nothing to be ...
3
votes
4answers
69 views

Find matches on adjacent lines

I want to find adjacent matching lines, e.g., if the pattern matches are $ grep -n pattern file1 file2 file3 file1:10: ... file2:100: ... file2:1000: ... file2:1001: ... file3:1: ... file3:123: ... ...
0
votes
1answer
34 views

Using Perl for Even/Odd numbers

Currently, I'm using a process to create a very specific set of four files. The Process I'm using is shown in the attached Process Image, below: The first line is part of a solution, given to a ...
0
votes
1answer
23 views

Perl code to refer to multiple file of the same extension (.xml)

I'm trying to parse multiple xml files but i'm a bit stuck with something. The $twig->parsefile("output_1.xml"); section of the below script works fine in parsing the file stated. However, I would ...
1
vote
2answers
51 views

I want search for a string and to pull all the lines between two patterns [duplicate]

I want search for a string and to pull all the lines between two patterns(including the pattern). START#1 Name S 101 Frankfurt_1_1 19 A+ Street END START#2 Name B 104 Berlin 20 A+ ...
3
votes
2answers
88 views

Search, insert, move and insert

I want to search each record (records are defined by blank lines) in a file for the pattern NAME#AAAA. If it matches, then insert an # in front of the record's AGE line and move that line to the top ...
0
votes
0answers
21 views

search insert and replace [duplicate]

I want to search each record (records are defined by blank lines) in a file for the pattern NAME#AAAA. If it matches, then insert an # in front of the record's AGE line and move that line to the top ...
0
votes
0answers
26 views

“cli” command in not working when passing through “Net::SSH::Perl”

This is my code : my $ssh = Net::SSH::Perl->new("$hostname", debug=>0); $ssh->login("$username","$password"); my $cmd = "cli version"; ($stdout,$stderr,$exit) = $ssh->cmd("$cmd"); print ...
1
vote
2answers
18 views

text to find and replace in all files and in all directories

I want to replace all occurrences of 1800 102 6022 with 1860 266 2666 in all files. I have different files in different directories which can contain 1800 102 6022. I am using: perl -pi.13.04.2016 ...
0
votes
1answer
54 views

How do I calculate the column percentage of a file?

I have a tsv file that contains some values. I want the sum of each column and total number of values and percentage values. Eg: file.tsv contains x 1 1 0 1 x x 1 x ...
0
votes
1answer
44 views

SSH into another VM via Perl / Sh script failing. Works manually

I want to run a Perl CGI script (a_web_page.cgi) from my dev box .1.20 that runs a bash script from the same folder (host_script.sh). This script then runs a SSH command to another server 1.10 that ...
0
votes
1answer
437 views

Issue with installing CPAN XML::RSS

I'am running debian on my server and want to install the CPAN module XML::RSS. But I get this error: http://pastebin.com/5syPaQfe (Pastebin because it's really long) I'am trying to install ...
0
votes
1answer
22 views

How to replace a text with another in Perl

Using tr command I want to convert Hello into Hii. My command was: $_="Hello"; print; tr/Hello/Hi/; print; But the result was Hiiii. What did I do wrong? What is the right way to do it?
0
votes
2answers
51 views

Help in making multiple lines as single lines

I have below 4 lines: EXTRACT ETEST Last Started 2016-03-20 20:56 Status RUNNING Checkpoint Lag 00:00:02 (updated 00:00:04 ago) EXTRACT PTEST Initialized 2016-03-31 06:25 Status ...
6
votes
4answers
26k views

compare two columns of different files and print if it matches

I am using solaris 10 and Grep options involving -f doesnt work . I have two pipe separated files: file1: abc|123|BNY|apple| cab|234|cyx|orange| def|kumar|pki|bird| file 2 : abc|123| ...
1
vote
2answers
49 views

SED Search and Replace on Linux [duplicate]

I want to change the value from 1521 to 1525 in FROM_HOST only in file gexhosts.cat: FROM_HOST db201521 TO_HOST db201521 Is there a way to do that or some work around? I would really prefer ...
0
votes
3answers
31 views

Perform regex search on a previously regex-matched line (one-liner)

I need to print a string which is in a unique line in a long text file. Example relevant line in file long.txt: Software version 4.0.10, 2002-03-28 The wanted string is exactly 4.0.10. The steps ...
1
vote
3answers
43 views

Count occurance of number and delete line of matches value

Could I get some help please with my problem? I have a file that looks like this (comma separated): A,250,13,820,0,80,201 B,0,0,0,0,3,0 C,0,2,1,0,0,0 D,0,1,105,0,0,10 I would like to ...
5
votes
0answers
54 views

Perl one liner to find words longer than 63 characters

I have a number of xml files containing sanskrit texts to be converted to tex. Latex has a maximum of 63 characters per word for its hyphenation to work, everything longer than that will not be ...
28
votes
3answers
20k views

What does ${1+“$@”} mean in a shell script, and how does it differ from “$@”?

In the Perl documentation, perlrun(1) suggests launching Perl scripts using a bilingual shell/Perl header: #!/bin/sh #! -*-perl-*- eval 'exec perl -x -wS $0 ${1+"$@"}' if 0; What does ${1+"$@"} ...
-1
votes
3answers
81 views

Shell scripting : want to login on some server, which are in same domain and execute command and exit

I have 10 unix servers, I want to log into them one by one, execute 4-5 lines of code, save the output and exit. For Example: 10 serves: Intially at xyz server Login in server 1 --> execute 4-5 ...
-3
votes
1answer
43 views

Meaning of this perl command [closed]

I found this command perl -ne 'print $1 if m/\.([^.\/]+)$/' and I'd be very grateful if someone familiar with perl could tell me in a nutshell what exactly all the syntax means, it would save a lot of ...
0
votes
0answers
26 views

perl script stall nanosleep() call in strace output

I have perl base SIP client which calling for SIP REGISTRATION process but i am seeing it stall for 10 second at nanosleep() call send(4, "REGISTER sip:sip.example.com S"..., 513, 0) = 513 select(8, ...
3
votes
4answers
90 views

How to delete a specific number in file?

I have a file: 1 2 5 6 8 0 0 0 0 1 2 5 6 8 0 0 0 0 1 2 5 6 8 0 0 0 0 1 2 5 6 8 0 0 0 0 I want delete all zeros: 1 2 5 6 8 1 2 5 6 8 1 2 5 6 8 1 2 5 6 8 I tried tr -d [:0:]. Unfortunately, it ...
3
votes
1answer
316 views

How to print incremental count of occurrences of unique values in column 1

I'm trying to come up with an solution to this problem, I need to incrementally count and then print the counts of the unique values in column 1 of a tab delimited text file. Here is an example: ...
0
votes
0answers
11 views

No 'Makefile' created KAMENSKY/Text-Bidi-2.11.tar.gz [duplicate]

I am trying to install following perl module via cpan on centos 6.x but unfortunately getting error. Please advise to solve. Text::Bidi Version: 0.03 Usage: Label batch PDF CPAN /usr/bin/cpan ...
0
votes
1answer
68 views

No 'Makefile' created KAMENSKY/Text-Bidi-2.11.tar.gz

I am trying to install following perl module via cpan on centos 6.x but unfortunately getting error. Please advise to solve. Text::Bidi Version: 0.03 Usage: Label batch PDF CPAN /usr/bin/cpan ...
3
votes
1answer
109 views

Bash script can't locate perl module

I have a shell script which isn't running menutray on i3 startup. Line in .i3/config: exec ~/.i3/i3-scripts/menutray.sh This is what I tried for debugging: #!/bin/bash menutray -i -u -r ...
0
votes
4answers
55 views

Extract ranges of lines from a file, saving each range to a separate file

I have a file that looks like this 740*02/01/2016*00:00* EJ LOG COPIED OK AUTO INIT COPY DRIVE NOT CONFIGURED E1EF3901 [020t*741*02/01/2016*05:45* *TRANSACTION STARTED* [020t CARD INSERTED ...
4
votes
3answers
395 views

How to replace a multi line code with sed?

I have a large file which has special characters in it. There is a multi line code there, that I want to replace with sed. This: text = "\ ------ ...