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
3answers
26 views

Merge lines between keywords into one-line comma separated values

Between first occurrence of Cat to next occurrence of Cat, it should create a separate line with delimiter as ",". File input as below. Cat AA BB CC Cat AA-1 BB-1 CC-1 Output expected: Cat,AA,BB,...
0
votes
0answers
21 views

taking the input from one file and related info from another copy it to new file

I have a inputfile contains phone numbers like 7463213456 8725678845 In another file I have info for every file like 7463213456;553256324;HIW456DFC;base_rsa;VSHD*CFGH...................... ...
0
votes
1answer
30 views

How to run a perl script inside another perl script

I have two Perl scripts and want to use one script from another. The scripts are called script1.pl and script2.pl. I want to run the below command inside script1.pl : /home/user/script2.pl /var/log/...
0
votes
0answers
19 views

how to link excel sheet to perl by moving excel sheet to some directory in pc that should be in our network [closed]

in order to link the excel sheet to perl script in order to reflect changes made in excel sheet we have to move that excel sheet to some other place in our pc like some other directory am not sure. so ...
-5
votes
0answers
23 views

Error while running the Perl script [closed]

Error: Use of uninitialized value $source in -e at /nfs/site/proj/inway_arch/tools/opensource/perl/5.20.2/lib/Spreadsheet/ParseExcel.pm line 682 file not found
1
vote
1answer
15 views

how to see the changes made in a big perl script having the copy of original that is to compare both in a splitted gvim editor simultaneously

In a particular perl script and I have a copy of the same but with the changes made in it i want to see both the scripts in such a way that changes made in the copy to be highlighted in a split gvim ...
-1
votes
0answers
17 views

perl error: Global symbol requires explicit package name [migrated]

while executing the perl script which is accessing the xls sheet I got this error: Global symbol "$mux_reg_name_col" requires explicit package name at Clk_verif_gen.pl where $mux_reg_name_Col is ...
0
votes
0answers
18 views

how to access xls sheet through perl script [on hold]

To access the excel sheet through perl how that can it be done? where to add that excel sheet so that it can be accessed.
3
votes
1answer
39 views

How can I completely reinstall Perl on Debian without having functional Perl?

Long story short: I made a pretty ridiculous stupid error when trying to configure CPAN that resulted in me having two half-versions of Perl, both of which are missing important packages. In ...
0
votes
3answers
45 views

Print/export csv file into array

I have the following data in a very large csv: "sortorder","name","description" "1","B.1","Boiler room" "2","1.1","First office" "3","1.2","Second office" etc... Which I would like to end up in ...
13
votes
2answers
447 views

How should I check whether a given PID is running?

I'm writing a Perl script that parses logfiles to collect PIDs and then checks whether that PID is running. I am trying to think of the best way to make that check. Obviously, I could do something ...
0
votes
0answers
18 views

How to add a # to the begining of a line, only specific lines that I grep for [duplicate]

I have a file that has many thousands of lines. I what to comment out only specific lines in the file. I want to add a "#" to the beginning of the greped for line plus 2 lines above and one line below ...
0
votes
1answer
43 views

Build a sitemap from local PHP forum pages

I've been reading stackexchange for years now, and always managed to find an answer to the problems I had to deal with. This time however, I'm going to ask a question as I could not find a solution to ...
2
votes
5answers
311 views

Reducing the complexity of the data in text file

I have this file: 1 2 2 7 3 4 4 7 5 3 6 7 7 1 8 2 9 4 And my desired output is 1 13 2 17 3 7 In my input i have 9 rows and i want to reduce it to three rows while ...
2
votes
2answers
121 views

Text manipulation: Extract everything inside brackets

I have a text file where every line is in a similar format to this: %#&#%# [Dinero] / Money / !#@%$@ [Dia] / Day / $%&$^#@ [Perro] / Dog / I am looking to extract the words ...
2
votes
1answer
33 views

Perl: General way of finding size of block device

I use -s regularly to find the size of a file. It works cross platform. Is there a similar well tested way of finding the size of a block device? We are not talking the size of a filesystem or the ...
-1
votes
0answers
22 views

Filter two file extension in if statement in perl script

How do I filter file extensions .csv and .CSV in an if statement? Below testing failed. 67 opendir ( DIR, $source ) || die "Error in opening dir $source\n"; 68 69 foreach my $fileName (readdir(...
1
vote
1answer
16 views

How to permanently set some path in @INC

I want to set a path in @INC, as script is failing to locate perl module. Requirement is that , i cannot include the module path in the script directly. So , i am thinking to add module path directly ...
2
votes
1answer
41 views

redirect output of command to /dev/null

I run the following line from my bash script in order to run the script /usr/run.pl on remote machines xargs -P "$numprocs" -I '{}' -n 1 -- perl -e 'alarm shift; exec @ARGV' -- "$timeout" ssh -...
0
votes
1answer
43 views

Split xls file into small xls files [closed]

I want to split the sample.xlsx (containing 3 sheets) file into the 3 different sheet1.xlsx sheet2.xlsx sheet3.xlsx files , I have John McNamara Perl package repositories VERSION = 2.37. I am adding ...
2
votes
3answers
44 views

rename(1)-like script in Perl, but for copying files?

So there's this rename(1) Perl thing. It suits my task precisely, except that I need it to basically cp files instead of mv. How to achieve that? I have quite a few rules of renaming, all expressed ...
1
vote
2answers
83 views

Perl stripping substring with $ in front

I get that perl thinks the part of the string with $ are perl variables. What I'm trying to do with the perl call, is redefine variables preceded by a $ as \$, but that's throwing other errors. I ...
0
votes
0answers
35 views

Trying to execute vim function from plugin - can't get syntax correct

I found a pretty neat VIM plugin which adds functionality for managing Perl scripts; it's called Perl-Support. I got it installed fine, and I'm trying to take advantage of all the custom functions/...
2
votes
1answer
36 views

Tweak perl script for human-readable dmesg output

In RHEL 6 I have the kernel parameter: printk.time=1 So that my dmesg would have a timestamp. However it shows in seconds from restart, like this: [12.23456] I found a script that you place ...
0
votes
1answer
54 views

How to submit multiple commands as one liner in netbatch nbq commmand line

As title can someone tell how to submit a one liner command using nbq command line? Submitted multiple commands in Linux works fine but not in nbq mode as below. find /nfs/disks/test_dir/ -name ....
-2
votes
2answers
39 views

Data Manupulation required your help

I have a data as mentioned below. host_name Server1.domain.com contacts DL - Desktop contact_groups ravi, raj, rahim host_name Server2.domain.com contact_groups DL-Server host_name Server3....
1
vote
1answer
41 views

sh script containing perl element does not produce same output via crontab as manual execution

I tried posting this on Stackexchange but I think I may have more chance of a correct answer here as its very linux specific. I have an sh script which updates data in a csv, then runs a perl script (...
0
votes
0answers
39 views

Padre (perl IDE) package not found under Centos7

I wanted to install Padre the Perl IDE under CentOS7. I followed the Fedora page on the Padre wiki : http://padre.perlide.org/download/fedora.html It just says install is done through: # yum ...
3
votes
6answers
1k views

How do I remove a words ending in the letter S if duplicates without an S on the end are on the same list?

I have a large list of words. Many of the words are only different because they have the letter s on the end. If a word on the list is the exact same as another word on the list, except one of the ...
3
votes
2answers
86 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 PC....
2
votes
2answers
43 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
36 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 ...
3
votes
5answers
318 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]) (...
-3
votes
2answers
51 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 ...
1
vote
0answers
21 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 ...
0
votes
1answer
34 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 ...
1
vote
3answers
37 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
26 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: ...
3
votes
2answers
75 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
33 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 ...
4
votes
1answer
412 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 ...
2
votes
3answers
195 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: :% ...
3
votes
4answers
83 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
25 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 ...
0
votes
1answer
41 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 ...
1
vote
2answers
52 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+ ...
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
36 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 $...
3
votes
2answers
93 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 ...
1
vote
2answers
19 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 -...