Questions tagged [perl]

Perl is a powerful, high level programming language. Questions about Perl should be limited to the Perl development environment, running Perl, or using Perl to automate tasks on your computer.

Filter by
Sorted by
Tagged with
0 votes
0 answers
54 views

Perform lookup on two files

I have a csv file that get's SFTP'd to a RHEL box I have setup. It then gets transformed a little before another process SFTP's in and grabs it sending it off to be imported to a DB of a 3rd party. I ...
Jeremy's user avatar
  • 1
0 votes
1 answer
39 views

Combine two regex formulas into one (using notepad++)

Si cum îi semănau ! Fraţi buni, puindu-si, ca si el, tot sufletul în ceea ce făceau, muncind din greu, luptind din greu, jert- findu-se, fără nici un gînd de răsplată. Simțind în tot ceasul, ...
Just Me's user avatar
  • 816
2 votes
4 answers
65 views

REGEXL Find the string betweet 2 strings

In the exemple below, I want to use regex as to find the html tag <sony> between other 2 lines. <table width="697" border="0"> <tr> <td&...
Hellena Crainicu's user avatar
1 vote
0 answers
88 views

Clear previous command output (not full screen)

Example This is on the terminal screen: user@host ~ % ls dir1 dir2 dir3 user@host ~ % whoami user user@host ~ % date Wed May 24 16:25:26 -03 2023 user@host ~ % [CURSOR IS HERE] I'm trying to ...
ranemirusG's user avatar
0 votes
1 answer
219 views

How to install Perl modules in custom location?

I'm currently trying to install a Perl module, but the web hosting has specifically locked the custom Perl user install directory (they have a "install service" charging 7$ per module). So ...
sebastian nielsen's user avatar
0 votes
1 answer
22 views

regexp in perl fails

Why is this failing? WGroleau@MBP Chords % perl -p -i -e '(Trinidad|Donoso|Clifton|Frincke|Little|Church|Antonio) XYZ :\1\t:g;' *txt Bareword found where operator expected at -e line 1, near ") ...
WGroleau's user avatar
  • 724
0 votes
1 answer
19 views

Perl LWP: how can I print the fetched result?

What are the elements of the class response from this code: Or, how can I print the entire object response ? #!/usr/bin/env perl # Example code from Chapter 1 of /Perl and LWP/ by Sean M. Burke # ...
user1766349's user avatar
1 vote
1 answer
50 views

Perl LWP: running a script returns an error

I have installed Bundle::LWP and after several minuets I'm getting this $ perl -MLWP -le "print(LWP->VERSION)" 6.68 which sounds OK. However, running this script #!/usr/bin/perl # ...
user1766349's user avatar
0 votes
1 answer
180 views

Add line number at the end of each line in a text file

I have a text file which contains thousands of lines with same links. I want append the line number at the end of each line. For example; https://example.com/ https://example.com/ these links would ...
Denied Access's user avatar
0 votes
1 answer
35 views

Linux - Find string and then end of section

I have an XMLTV file. I need to get all of the programme sections for a specific channel. An example snippet: <programme start="2023031305000 -0400" end="2023031305300 -0400&...
Dan Marcoux's user avatar
0 votes
1 answer
205 views

How to find the "pattern" in FASTA file and record the cordinates along with header

I am looking for a solution to search for a string of 17 base pairs in the FASTA file that is the human reference genome. To clarify, in simple words and put the resources, i have tried grep function ...
Santosh's user avatar
1 vote
1 answer
45 views

Cygwin Perl autodie 'not located'

I have Cygwin installed (with its native Perl support). However, on running a make file supplied by a third-party, I get the following error: Can't locate autodie.pm in @INC (you may need to install ...
Mark Saunders's user avatar
1 vote
1 answer
33 views

perl extended regex pattern with (condition) behaves wrong, what I do false?

I use perl --version perl 5, version 36, subversion 0 (v5.36.0) built for i686-linux-gnu-thread-multi-64int (with 52 registered patches I have used following test lines with these results: perl -we '$...
Anton Wessel's user avatar
0 votes
1 answer
24 views

Perl RexEx Replace locks Apache access_log

I wanted to clean up my apache server logs, remove all the 301, 404, and so on, and after trying and failing with sed, I used Perl, which worked wonderfully, except... Then Apache no longer logs ...
Alan's user avatar
  • 505
0 votes
0 answers
16 views

How can Perl based daemons recover gracefully from momentarily unavailable NFS sources?

I have Perl scripts (running as daemons) on a large group of servers, where some Perl modules are used from an NFS mount. Sometimes, these mounts are temporarily unavailable, and if at the exact ...
boardrider's user avatar
  • 1,055
0 votes
3 answers
51 views

Replacing double new-line in multiple files

I do a lot of text cleanup with (example) perl -p -i -e 's:old:new:g;' *.txt but when old is \n\n and new is \n</p><p>\n, nothing changes.  Tried escaping the angle brackets, but that didn'...
WGroleau's user avatar
  • 724
3 votes
1 answer
4k views

What does --allowerasing option in dnf command do?

I am reading a book which instructs me to install 5.24 stream and minimal profile of perl module by running... # dnf module install perl:5.24/minimal --allowerasing Everything was explained in it ...
Aryan's user avatar
  • 31
0 votes
0 answers
18 views

Looking for an efficient way to query "perldelta"s for news

A common problem I have with Perl is this: I want to find out at which release some feature had been introduced. There were several "perldelta" manual pages (one for each release), but I'm ...
U. Windl's user avatar
  • 516
2 votes
2 answers
106 views

Find and delete near duplicate lines with certain punctuation

I have a text file with millions of lines. Some lines contain the same alphanumeric sequence, but differ in case and punctuation. I consider these lines duplicates. I want to remove any duplicate line ...
Priora's user avatar
  • 35
0 votes
1 answer
189 views

Perl regex unable to match using hex or octal

I need to use Perl to work with a data file that contains a lot of unprintable characters, i.e. not within the displayable character range in the ASCII table. I tried writing regexes using octal ...
Isla's user avatar
  • 1
0 votes
1 answer
121 views

quote mark (U+0027) in perl substitution

I need to put two spaces between sentences in a large number of text files. A sentence ending is defined as period, exclamation, or question, maybe a close-quote, and then a space. Tabs and line ...
WGroleau's user avatar
  • 724
0 votes
2 answers
533 views

Trouble with perl and UTF-8

If I interpret documentation ci=orrectly, perl --CSD is suppose to ensure that input and output, processed or commands, are using UTF-8 encoding. But if I replace two hyphens -- with an em-dash — (U+...
WGroleau's user avatar
  • 724
1 vote
1 answer
43 views

How do I substitute the entire line in a text file for a portion of text in the line?

For example, I would like to make: >sid|RSV210|ref|NC_001803.1| SM:RSV210 turn into >RSV210 I believe that I could use sed to do this by the following "s/>.*/>RSV210/" but I ...
Estefany Guzman's user avatar
0 votes
1 answer
137 views

how can I put 2 files with the same number of lines side by side with Perl

how can I put 2 files A and B with the same number of lines side by side with Perl with command line ? I cannot work with two filehandles on the command line.
user1642683's user avatar
0 votes
1 answer
35 views

Perl RE global matching is not working /.*(11).*/g

I have a file containing this single line: 111112111122113 I want to match all two element sequences of 1 in all occurrences. But when I try this $ perl -lne 'print $1 if /.*(11).*/g' u I get only ...
user1642683's user avatar
0 votes
2 answers
518 views

Remove the file name from a messy path in a text file awk or sed

I have an xml file with many lines containing something like this: Save="C:\Users\Administrator\Desktop\my files\1020\A54f\Drawing965.DWG" Module="0" Save="C:\Users\...
Priora's user avatar
  • 35
0 votes
0 answers
135 views

Perl, modifiers /m /s/ /ms

I have seen in Larry's Wall book programming Perl 3rd edition what do the modifiers /s /m /ms in some example with \n . Now I cannot find the exact page. Specifically the example showed that only the ...
user2925716's user avatar
0 votes
2 answers
69 views

opendmarc: hostnamefqdn() shows only short name / helo command rejected fqdn

I have problem with opendmarc. This software uses perl function to send report mails. So in the source code I see that /etc/opendmarc_reports uses also function hostnamefqdn() to pass it to helo ...
Macsurf's user avatar
0 votes
1 answer
382 views

500 Internal Server Error when run perl file and no access to command line

I'm a newbie with Perl. I've created a simple file test.pl with the code: #!/usr/bin/perl print 'test'; uploaded it to my shared hosting with Linux where PERL is enabled and changed my PERL file ...
sprsr's user avatar
  • 229
0 votes
1 answer
275 views

Why does this regexp — which attempts to match characters between “@” characters — fail?

I need to extract the second field of selected lines in a GEDCOM file. These lines are all of the following format: % grep @ /tmp/XYZ | tail -5 0 @X701@ OBJE 0 @X702@ OBJE 0 @X750@ OBJE 0 @X765@ OBJE ...
WGroleau's user avatar
  • 724
-1 votes
1 answer
138 views

Need to autoincrement directory names but by avoiding some letters in the name

My script creates a set of directories aa, ab, ac, and so on This script autoincrement directory names but I want to avoid the letters: I, O, P, Q, R, W while creating directories. The script which I ...
Purple's user avatar
  • 3
1 vote
1 answer
439 views

Unable to install DBD::mysql on Ubuntu 20.04

I am unable to get DBD::mysql installed on Ubuntu 20.04. I get the following error: Warning: No success on command[/usr/bin/perl Makefile.PL LIB=/home/htm/Lib] DVEEDEN/DBD-mysql-4.050.tar.gz /usr/bin/...
HTM's user avatar
  • 21
0 votes
1 answer
112 views

Sending args from bash to perl

I eally need help I would like to send args from bash file to perl file. I dont know why it is not working for me. My code foe testing is bellow *******bash code ********* #!/usr/bin/env bash chmod +...
user8417133's user avatar
0 votes
1 answer
46 views

a very simple Perl script needed

I have the following text file G.txt. I need a perl command perl -e ... that would extract all negative entries ending with Kč, so that first line it will be -107,60 and last will be -63,00 I have ...
user113823's user avatar
0 votes
1 answer
308 views

Combining two txt files containing name and last name on command line

I have two text files. First file have 20 Names listed in seperate lines and 2nd file have 20 surnames listed in seperated lines. How I can combine those files. So final text file have both first name ...
Roxion's user avatar
  • 344
1 vote
1 answer
644 views

How to make fork() fail?

For a script I'm writing, it's important to properly handle a failed fork() (see https://rachelbythebay.com/w/2014/08/19/fork/ for the Why). But how, without bringing my system down with processes, ...
AlasiaSpritzig's user avatar
0 votes
0 answers
132 views

Reading email headers in Perl

I have an email account ([email protected]) and an alias ([email protected]) pointing to the account. An email sent to [email protected] is delivered to us[email protected] as expected. Email headers in MS ...
Niso's user avatar
  • 21
0 votes
1 answer
73 views

Perl/Bash Solution to Test if a Folder Has Changed, Then Create Copy of It

I'd like to put together a script for a very rudimentary backup system that checks a directory recursively for any changes since the date another directory (the backup) was created and, if it finds ...
Timothy R. Butler's user avatar
3 votes
0 answers
38 views

How to rename a perlbrew installed version

I installed Perl 5.32 with the name perl-5.32.0 $ perlbrew list * perl-5.32.0 The installation was updated with perlbrew upgrade-perl and I now have 5.32.1 $ perl --version This is perl 5, version ...
Matteo's user avatar
  • 7,737
2 votes
1 answer
107 views

Shell special chars blowing up regexp(s) in all: sed, (g)awk, and perl [closed]

I would like to change the PS1 in my ~/.bashrc programmatically with any of the the most popular regexp tools { sed, awk or perl }. However, I have problems with special characters. Note that in the ...
ubixy's user avatar
  • 21
0 votes
1 answer
98 views

Transpose vertically with a catch

I've been working through some issues preparing data for logstash ingestion. I have a decent chunk of the process worked out but I'm wondering if there's a better way to do this. Basically I need to ...
Steve Zemlicka's user avatar
4 votes
2 answers
6k views

Is there a way to execute a perl script from any location in the machine?

I'd like to know if there are other ways to execute a perl file without giving the path explicitly. example: perl ./images/seed/test.pl I read on the export path command but I don't quite understand. ...
Alyssa Low's user avatar
1 vote
1 answer
427 views

How do I upgrade SpamAssassin?

When I try to update SpamAssassin, it says it has the latest version. # cpanm Mail::SpamAssassin Mail::SpamAssassin is up to date. (3.004004) However, the latest version says it is 3.4.4. https://...
Chloe's user avatar
  • 5,796
1 vote
2 answers
707 views

Regex to substitute character with numbers around it in filenames with rename utility (perl based)

I would like to rename files that have the following format: somethingblabla15T06:58_31+0000somethingblabla.bla THe new name should be somethingblabla15T06:58:31+0000somethingblabla.bla So the _ ...
linux_user_11880's user avatar
2 votes
1 answer
454 views

How to print absolute path of some file from c:\ root in perl?

Having this perl: #!/usr/bin/perl -w use Cwd qw[abs_path]; use autodie; opendir C, "c:\\"; @ar = map { abs_path($_) } readdir(C) or die $!; print $ar[0]; I am trying to print an absolute ...
Herdsman's user avatar
  • 331
2 votes
2 answers
562 views

Combine strings with same first word preserving their order

I have a file that contain many lines consecutive and non consecutive with same first word and i want to merge all those lines.Not finding any way. please suggest someone. eg. cat file X blah blah ...
Daichi Ash's user avatar
0 votes
1 answer
563 views

Associate .pl files with Prolog instead of Perl system wide

I'm learning Prolog at University and have a lot of *.pl files. I already managed to make gedit recognize them as Prolog files and not Perl Scripts for syntax highlighting following this question and ...
DrecksHippy's user avatar
0 votes
3 answers
969 views

sed + how to replace numbers with parenthesis with sed/awk/other

we want to relapse the [1023,1024,1022] as described in the following file , with [1022] more file.exm {"topic":"nj_hgf_dfgef","partition":0,"replicas":[1023,1024,1022]}, {"topic":"nj_hgf_dfgef","...
King David's user avatar
0 votes
1 answer
423 views

OpenSSL Timestamp log location

I am trying to debug an openssl ts based perl http server. The server logs display an openssl ts -reply command failing with exit code 1. Where can I see the logs related to this openssl command, or ...
Norbert's user avatar
2 votes
0 answers
184 views

Python and Perl not recognized in cmd even after adding in environment

It was fine yesterday, but it suddenly stopped working today. Both my perl and python were not recognized in cmd. I read as much as i can online for the answers and follow the instruction. I have ...
niknur's user avatar
  • 21

1
2 3 4 5
10