Skip to main content

Questions tagged [perl]

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 graphics programming, system administration, network programming, finance, bioinformatics, and other engineering applications.

0 votes
5 answers
118 views

Remove three lines from file until a match

982 01:25:09,473 --> 01:25:10,978 Stay with me. 983 01:25:09,473 --> 01:25:10,978 Stay with me. 984 01:25:15,390 --> 01:25:18,484 ( MAJESTIC MUSIC ) I want to delete three lines below 984 (...
Jakub Fiala's user avatar
2 votes
2 answers
251 views

Perl script to remove repeating header/trailer in file

I have created a perl script to merge 10 file in one. Each file has Keyword header/Trailer in file. So merged file has multiple header and trailer keyword. but I require the header and trailer to be ...
Worker's user avatar
  • 37
3 votes
3 answers
207 views

Print a line matching pattern1 unless next line contains pattern2

I want to match lines that have foo unless the next line contains bar. So given a file containing: 1 foo 1 foo 2 baz bar bap only 1 foo 1 would print. I got this to work using a negative lookahead /...
ScottyChi's user avatar
0 votes
2 answers
274 views

perl has problem if filenames contain dashes

... | perl -pe "s/([^$filespec]*)($filespec)/ ... So I have a function where the above construction works fine if $filespec is most things. However if there's a dash in the file name I get an ...
Ray Andrews's user avatar
  • 2,527
3 votes
1 answer
274 views

Different encoding/Unicode interpretation using terminal vs using shell script

I was working on a keymap script (map keys from one language keyboard layout to another). And after a lot of hard time trying to get everything working I found out that different characters are ...
Andrew15_5's user avatar
9 votes
1 answer
3k views

What are the different versions of the rename command? How do I use the Perl version?

This is a mess. How do I know which command to use when we expect Perl's rename with s/// sed-like syntax, when there're tons of different implementations of rename, that are different versions of the ...
Gilles Quénot's user avatar
0 votes
3 answers
645 views

How to convert seconds to hh:mm:ss.ms when getting difference between 2 times

I performed a calculation that converts current timestamp giving milliseconds as well using perl command such as below: perl -MTime::HiRes=time -MPOSIX=strftime -e ' $now = int(time() * 1000); printf &...
Christopher Karsten's user avatar
0 votes
2 answers
525 views

Remove multiple occurrences using SED command

We had a requirement to remove all /t characters that are not followed by quotes sed 's/\\t\([^"]\)/foo\1/g' this command worked good for single occurrence. What option do we need to add remove ...
Radhe's user avatar
  • 1
0 votes
1 answer
177 views

Missing EXTERN.h file when installing claws-mail on Fedora 37

I've trying to compile Claws-mail but got error: perl_plugin.c:54:10: fatal error: EXTERN.h: No such file or directory 54 | #include <EXTERN.h> I've installed perl-core perl-devel was ...
jcubic's user avatar
  • 10k
1 vote
2 answers
2k views

How may I replace a string in an XML file?

I am trying to replace the string inside an XML file. From <hello="value" exampleno="xxxx:yyyyyyyy/dd=eeeee-ffffff,aa=bb ccc,dd=eeee,ff=gggg,hh=iii,jj=kkk,ll=mmmm" /> I want ...
Ganesh's user avatar
  • 19
1 vote
1 answer
62 views

How many codes written by perl in debian?

My debian os: cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" ...
showkey's user avatar
  • 405
1 vote
6 answers
935 views

Find and replace a multi line text file in another multi line text file

I fought with it for so long but I am now completely out of ideas. Maybe someone here will be able to help me. Here is what I want to achieve: file_1.txt: # Some comment some_variable="test" ...
Peksio's user avatar
  • 121
4 votes
1 answer
415 views

Using perl's rename to renumber a list of files, starting at a certain value

I'm trying to renumber a list of files, which at a given point in their filename have one index consisting of a four-digit number. These files are consistently output starting from 0001, but need to ...
sam_vh's user avatar
  • 43
0 votes
1 answer
566 views

Writing to unix socket file as fast as possible

I'm trying to write with perl to a unix socket file as fast as possible but failing on full message buffer. I tried autoflush and manual flush without success. use IO::Select; use IO::Socket::UNIX; ...
user496909's user avatar
0 votes
1 answer
204 views

How can I create a .txt file containing data being generated in real-time in Linux terminal when a program is running?

I am running an AutoDock Vina program (using a Perl script) in Linux.  It generates lots of important data (regarding binding free energy of protein-ligand docked complexes).  However, I cannot save ...
Alvea Tasneem's user avatar

15 30 50 per page
1 2 3
4
5
91