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.

1 vote
0 answers
17 views

Problem enabling perl module stream AlmaLinux 8.10

I have an issue with our AlmaLinux 8.10 systems that they suddenly have issues with perl dependancies. It tuns out that the current active perl stream is 5.26 (dnf module list perl*) but some packages ...
Stefan Lelieveld's user avatar
-1 votes
3 answers
90 views

Delete 2-line paragraphs, keep 3-line paragraphs, maintain newline between all

On a Linux machine with GNU tools I have an ascii file that consists of only 2-line and 3-line paragraphs, each paragraph separated by a newline. All 2-line paragraphs are to be deleted so that all 3-...
stampeder's user avatar
0 votes
1 answer
44 views

version `XCRYPT_2.0' not found after Update Debian 10 to Debian 12

I was instructed to upgrade Debian 10 to Debian 12. After the upgrade, I noticed that the ssh.service was not working. Now I found out that no 'apt' commands work. I can't install anything. Here the ...
Szymon Tesmer's user avatar
16 votes
5 answers
1k views

How can UserA programmatically replace a text string within a file they own that's located in /etc?

A non-root linux user owns a text file that's located in /etc, where the non-root linux user does not have permission to create files. The non-root linux user can edit the file manually via vi without ...
Tortoise Pirate's user avatar
0 votes
1 answer
40 views

What does the line ($eachJOBID = $eachScriptNoPath) =~ s/\.csh// ; do?

This line I have in my code cuts the .csh from a string and returns the rest of it. Can someone explain what each part of it does? ($eachJOBID = $eachScriptNoPath) =~ s/\.csh// ;
manylya's user avatar
1 vote
3 answers
73 views

Bash: sum a number present in N lines before a given pattern

I have a kdenlive project file (which is basically a xml file) with a lot of text clips inside. I need to bulk edit the x coordinate of a certain text that appears multiple times. This is an example: ...
baiserekku's user avatar
3 votes
1 answer
472 views

Why is one process ps command showing spaces around a directory instead of slashes?

I'm trying to debug a failing legacy process monitor that searches processes that are running. I determined it is being caused by some mysterious linux behavior. The process being ran is /opt/my/path/...
k.schroeder31's user avatar
1 vote
1 answer
54 views

how to catch output from a subprocess?

I am trying to catch the password prompt of sftp, but somehow it is not from STDIN or STDERR. It possibly comes from a sub-process. The following is my test. I tried to redirect the password prompt to ...
oldpride's user avatar
  • 231
0 votes
1 answer
33 views

AWStats stuck, but no output on strace: How to debug?

A Perl script is stuck, root 1317478 99.8 0.0 264072 22516 ? R 04:57 478:37 /usr/bin/perl /usr/share/awstats/wwwroot/cgi-bin/awstats.pl -config=domain.tld-http -staticlinks -configdir=/...
Thomas's user avatar
  • 23
6 votes
3 answers
644 views

awk: sort by first column then second; output unique 1st column once but all 2nd column

I have a two-column file that you can create as follows cat > twocol << EOF 007 03 001 03 003 01 137 12 001 11 002 01 002 02 002 03 001 02 002 04 137 94 010 21 001 01 EOF The resultant file, ...
bballdave025's user avatar
0 votes
1 answer
71 views

How to combine ...if $x and a here-doc in perl? [closed]

How is one supposed to write this? print <<EOF; if $x bla EOF I think it is called postfix notation, and a here-doc. I get a syntax error. OK, I guess I'll just use print "bla" if $x; ...
Dan Jacobson's user avatar
3 votes
7 answers
434 views

How can I print the longest sequence of lines featuring numbers smaller than a threshold?

I am learning Perl, but I don't know how to solve this problem. I have a .txt file of the following form: 1 16.3346384 2 11.43483 3 1.19819 4 1.1113829 5 1.0953443 6 1.9458343 7 1.345645 8 1....
69 420 1970's user avatar
2 votes
1 answer
25 views

How to use `perldoc` within Emacs (shell)?

While programming using Emacs, you frequently consult manual pages. My environment is text-based Emacs via SSH. While I can open "Normal" manual pages in Emacs using the man command ((man ...
U. Windl's user avatar
  • 1,493
1 vote
1 answer
46 views

Search and replace content

PIN A 1 1:3 0:8 0 0:0 PIN B 1 1:0 0 0:0 Z Z:0 PIN C 1 1:3 0:8 0 0:0 Z Z:0 I would like to change the content on PIN A & PIN C only without affecting PIN B to 0 0:3 Z 0:3 Can't seem to find a ...
JSL's user avatar
  • 11
1 vote
1 answer
51 views

Report sed changes + corresponding perl syntax

Newbie learning Linux and perl: I would like to (a) search-replace strings, (b) match filename pattern .myfile., (c) look recursively in subdirectories, and (d) print the line number, file name, ...
Susie's user avatar
  • 13
1 vote
7 answers
313 views

Find all lines between two patterns, EXCLUSIVE of the second pattern?

Consider that I have the file listed below. I need to select all lines from every instance of the regex pattern Word A to before the regex pattern Word D. Word A Word B Word C Word D Word E Word F ...
RonJohn's user avatar
  • 1,144
0 votes
1 answer
30 views

getting started with PDL for cluster analysis PDL::Stats::Kmeans

I guess first up is the Question " is perl data language dead ?" I'm not finding any active discussions or user q&a sorry for not tagging this better I dont have the rep' my problem area ...
aldobranti's user avatar
4 votes
0 answers
47 views

Perl's `kill` is using `$! == Errno::EINTR` unexpectedly

I wrote a network daemon that forks off children to handle TCP connections. On SIGINT the main process triggers a kill for each child in order to clean up and to collect some final statistics. In ...
U. Windl's user avatar
  • 1,493
2 votes
3 answers
821 views

ARGV[] not accepting the argument

I have a shell script that I am trying to pass a date argument to ARGV[1] but the script is giving a blank output Here is the command: #!/bin/bash dt=$(date -d "yesterday" '+%m%d%Y') cat /...
NecroCoder's user avatar
4 votes
4 answers
2k views

Ist it possible to check the peer address before accepting a TCP connection?

I wrote a simple Perl server that listens on a TCP port/socket, accepting connections. Now I wonder: When wanting to implement address-based access control, is it possible to check the address of the ...
U. Windl's user avatar
  • 1,493
-2 votes
3 answers
120 views

bash + how to verify folders under specific path are ended with number/s

I want to check the folder/s under /var/kafka that all them are ended with number otherwhile I will exit with error ls -ltr /var/kafka drwxr-xr-x 399 kafka kafka 28672 Nov 9 13:10 data6 drwxr-xr-x ...
yael's user avatar
  • 13.4k
0 votes
2 answers
59 views

rename - move [ ] delimited part of filename to end of filename

I've been playing with the perl implementation of the rename tool in cygwin having finally got it working via installing from cpan. It's been a long time since i played with this stuff so I'm a bit ...
Adam B's user avatar
  • 3
2 votes
4 answers
211 views

Parse text file add semicolons before and after numbers; join all other words that are before/ between numbers with hyphens

I have a text file with accounts like: Input Sample Paid 100 15/02/2022 3000 recd 50 15/02/2022 nelur trip 3050 PAID 80 25/03/2022 Adjusted towards trip 3130 14 PAID 50 26/03/2022 Given to Nate Cash (...
tgkprog's user avatar
  • 249
0 votes
1 answer
470 views

How to remove characters from end of a line till a particular character in perl

my string is like $varin="wer.try.iuy.oiu.qert" i wanted to remove characters starting from end of the string till "." is encountered. expected output: wer.try.iuy.oiu have tried ...
Taylor_Sharma's user avatar
-1 votes
3 answers
152 views

Replace new lines at end for those lines whose 2nd field in colon separated file span over to multiple line

I have got multiple files with different set of contents but the pattern is same across mulitple lines in different files. sample input file : cat -n test.txt 1 adjfkhjdhfkjd: ...
Ashis Sahoo's user avatar
2 votes
1 answer
395 views

int seems to be not int in a used perl library

A peculiar phenomenon is on my mind. As you may know, dealing with a mail server directly exposed to the internet can be quite the 'joy' with various individuals attempting to break into it or use it ...
numchrun's user avatar
  • 508
8 votes
3 answers
988 views

Perl: change in interpretation of shell symbols in system() invocation?

Today I noticed that something changed in Perl, probably recently, in the way it runs shell commands. Could someone explain what has changed? I cannot find the answer myself and sadly we learned about ...
Kamil's user avatar
  • 1,491
0 votes
2 answers
308 views

perl: replace a string with variable containing new lines (line breaks)

I want to make edits containing meta characters. Here https://stackoverflow.com/questions/29613304/is-it-possible-to-escape-regex-metacharacters-reliably-with-sed one of solutions is via perl with s\Q ...
Martian2020's user avatar
  • 1,219
5 votes
4 answers
697 views

awk add a column if it doesn't exist

I would like to add a column 3 (description) if it does not exist in a ';' delimited file. example; #Gene;Transcripts;Description;Group gene1;G1a,G1b,G1c;gene1 is a good gene;6 gene2;G2a,G2b,G2c;gene2 ...
alex kiarie's user avatar
0 votes
1 answer
535 views

Check if two IP addresses are in a range

Using bash or perl on a minimal installed Linux, I am trying to validate two IP addresses if there are in a range. I came across a bash script that works well, but the fact that it prints all the IP ...
Bruce Malaudzi's user avatar

15 30 50 per page
1
2 3 4 5
46