Skip to main content

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.

0 votes
1 answer
220 views

How to get stock quotes in KMyMoney, GNUCash, or other programs using old/broken perl Finance::Quote

TLDR: I am unable to get online stock quotes from within GnuCash and KMyMoney. It seems that something is wrong with the perl Finance::Quote module. What is the easiest way to fix this? Background ...
rand'Chris's user avatar
3 votes
3 answers
663 views

Bash [[ test =~ regex ]] vs perl command result

Is the bash operator =~ equivalent to a perl invocation? filename="test-33.csv" regex="([^.]+)(-\d{1,5})(\.csv)" With bash test: if [[ "$filename" =~ $regex ]]; then ...
rellampec's user avatar
  • 133
2 votes
1 answer
340 views

Install Perl on Windows for LaTeX Packages Without Dependency Issues

I'm currently facing challenges with installing Perl on my Windows system, which I need for handling specific LaTeX related packages. My journey so far has led me through a series of issues, and I'm ...
Foad's user avatar
  • 682
0 votes
1 answer
62 views

database connection error with perl app (rt 5 - request tracker) connecting to Postgres database

On a CentOS 9 system I installed postgres via dnf # dnf info postgresql Last metadata expiration check: 3:26:33 ago on Tue 21 Nov 2023 12:13:48 PM PST. Installed Packages Name : postgresql ...
msacks's user avatar
  • 11
0 votes
1 answer
68 views

AWK replace some special new line to one line

i have some log like this: 2023-11-15T08:59:28.000000+00:00 database-1 # Time: 231115 8:59:28 # User@Host: rdsadmin[rdsadmin] @ localhost [] # Thread_id: 3 Schema: QC_hit: No # Query_time: 0....
dvthanh's user avatar
0 votes
0 answers
115 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
1 vote
1 answer
454 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
  • 866
2 votes
4 answers
342 views

REGEX Find the string between 2 strings

In the example 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
2 votes
0 answers
400 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
769 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
54 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
  • 824
0 votes
1 answer
106 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
245 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
424 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
54 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
1 vote
1 answer
400 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
  • 13
1 vote
1 answer
94 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
57 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
35 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
  • 525
0 votes
3 answers
202 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
  • 824
3 votes
1 answer
9k views

What does --allowerasing option in dnf command do?

I am reading a book which instructs me to install 5.24stream and minimal profile of Perl module by running... dnf module install perl:5.24/minimal --allowerasing Everything was explained in it except ...
Aryan's user avatar
  • 31
0 votes
0 answers
20 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
  • 705
2 votes
2 answers
126 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
415 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
218 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
  • 824
0 votes
2 answers
818 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
  • 824
1 vote
1 answer
47 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
220 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
39 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
643 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
161 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
81 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
546 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
  • 269
0 votes
1 answer
277 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
  • 824
-1 votes
1 answer
157 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
765 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
201 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
52 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
337 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
  • 354
1 vote
1 answer
936 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
174 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 [email protected] as expected. Email headers in MS ...
Niso's user avatar
  • 21
0 votes
1 answer
81 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
43 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,897
2 votes
1 answer
111 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
156 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
9k 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
588 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
  • 6,046
1 vote
2 answers
996 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
533 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
  • 371
2 votes
2 answers
650 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

15 30 50 per page
1
2 3 4 5
11