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.

Filter by
Sorted by
Tagged with
0
votes
1answer
47 views

POSIX floating comparison

working with a legacy system, here I'm connecting with sqlplus to store the returned value in a variable and its worked fine with me but the problem with compearing with floating values a numeric/...
0
votes
0answers
13 views

Perl resets the EUID only when executing multiple commands through `env - /usr/bin/perl -e 'system(“…”)'`? [duplicate]

I was playing around with setuid perl for command execution (insecure). I learned from another question, that env - /usr/bin/perl -e 'system("...")' doesn't reset the EUID to RUID, like it's the ...
0
votes
3answers
49 views

regex to group them same name

I have following lines in foo.txt aaa:6600 location: US aaa:6622 location: US xxx:6601 location: EU xxx:6602 location: EU xxx:6603 location: EU ggg:7701 location: KR ggg:8808 location: KR I ...
0
votes
3answers
70 views

one shell command to find every n-gram works in text

I have a text stream or a file that contains words separated by whitespace.  Like: I have a toy. you may not like it. Every whitespace-separated word may be composed by two or more small words, ...
0
votes
2answers
68 views

how to append line only if line not set after specific word

I build the following sed cli in order to add the following line force_https_protocol=PROTOCOL_TLSv1_2 after the line: [security] the sed cli : sed -i '/\[security\]/a force_https_protocol=...
0
votes
0answers
47 views

How can I determine if these perl processes are malicious?

Our Suse Linux web server has been running quite sluggish of late and rebooting relieves the issue temporarily. After some further checks, I found that the firewall is blocking some outbound traffic ...
0
votes
0answers
19 views

urxvt-perls M-Escape not working

I am a noob user of urxvt terminal and I would like to be able to copy a part of a text printed out previously without having to use the mouse. With a bit of research I have found this extension (...
-1
votes
0answers
11 views

Parsing a GenBank file with multiple gene entries [migrated]

Basically a GenBank file consists of gene entries (announced by 'gene') followed by its corresponding 'CDS' entry (only one per gene) like the two shown here below. I would like to extract part of the ...
0
votes
6answers
67 views

how to capture string from csv line that comes after specific word

how to capture string from csv line that comes after specific word for example , this is the csv line that we want to cut the strings that comes after /data/ status=true /data/sdb/hadoop/hdfs/log,/...
0
votes
1answer
53 views

Replace (remove) multiple lines from files

A server of mine was hacked, and they added at the beginning of every js file the following: var hglgfdrr4634hezfdg = 1; var d=document;var s=d.createElement('script'); s.type='text/javascript'; s....
2
votes
2answers
58 views

List a file from all directories but skip the ones whose folder contains a specific file

I have a perl script that processes .xml files which reside in multiple folders under a directory. The script takes the absolute file path using the output of ls using parallel. parallel -j 1 /home/...
11
votes
4answers
920 views

Is there a unix-like system that doesn't come with Perl?

As far as I know, every desktop/server distribution of Linux has Perl (and core modules) installed by default, AIX and Solaris (IIRC) also do. By "by default" I mean that even the most lightweight ...
0
votes
0answers
10 views

Can't locate getopts.pl with perlbrew

My system have Perl 5.10.1 by default.I am able to execute the perl script successfully with it. I installed Perl 5.16.3 and 5.30.1 using perlbrew. When I use these versions with perlbrew and execute ...
1
vote
3answers
88 views

How to replace a line in text using RegEX?

The problem I have is that is trying to match both sets of delimiter (above and below) I'm trying to match only the second part of the delimiter below (bolded). This is so I can add a new version ...
0
votes
3answers
89 views

Bash script in a Perl script hangs

I'm running a small bash script in a Perl script on a Mac, but the bash script seems to hang when finished. The Perl script doesn't pick up and continue. The bash script works great in a shell window. ...
0
votes
1answer
35 views

Cutting out specific text from specific lines in real time

So I have a log running in real time and saving to a text file named 'test.txt' also in real time. Now I want to set up a process that constantly polls that text file for changes and cuts out a ...
0
votes
2answers
75 views

How can you make the one-line version of Perl grep into an alias?

I found that we can use perl -wnle "/RE/ and print" such as perl -wnle "/^.{0,80}$/ and print" or grep -ri someText * | perl -wnle "/^.{0,80}$/ and print" to exclude lines longer than 80 ...
1
vote
1answer
35 views

Perl opendir() only allows one operation?

I've found a strange issue with perl's opendir() function that makes absolutely zero sense to me. In the following example perl will open the directory specified by $path and pull out all of the ...
0
votes
0answers
56 views

Calling a perl script from my bash script: Perl script won't follow symbolic links

There is a perl script, which for various reasons I cannot change, which does things. When I use it from the terminal, it works perfectly on regular files and symlinks: $ perl_script file_to_use I ...
1
vote
1answer
27 views

Prevent SIGINT from reaching mysql subprocess

I have a perl script, which indirectly invokes mysql (to execute a long SQL script). I would like to disable Ctrl+C while that script is running, but somehow the signal still reaches mysql, which then ...
-2
votes
1answer
44 views

Perl script to remove line from one pipe-separated file using another file have one matching column

I have two huge files, File A containing all records as pipe (|) separated columns, and File B which has one column. I need to remove all lines from File A where that one column value matches with ...
3
votes
0answers
26 views

Is it possible to get the apache server-status page without sending a GET request to one of the workers?

I have the server-status page setup and can access it through http://localhost/server-status and commands like apache2ctl status. Is there a way to access the infromation in the server-status page ...
0
votes
0answers
20 views

How to fix this pkgsrc upgrade error related to p5-XML-XPath-1.44?

How to fix this pkgsrc upgrade error? ---Jan 21 14:00:59: upgrading perl-5.30.1... pkg_add: Can't open +CONTENTS of depending package p5-XML-XPath-1.44 pkg_add: 1 package addition failed ---Jan 21 14:...
0
votes
1answer
84 views

Is GNU grep's -P option safe to use in production?

The man pages for grep on Ubuntu 18.04 and CentOS 8 have this to say about the -P option for grep: -P, --perl-regexp Interpret the pattern as a Perl-compatible regular expression (...
0
votes
0answers
146 views

execute perl script from a shell script, assign output to shell variable or print to a temporary file

Is it possible to call a script from a inside a shells script, and assign the result of that script to a shell variable? Or print the result of that perl script to a file? sample: #!/usr/bin/sh /...
0
votes
3answers
31 views

Replace the trailing zero's of the date fields in the line

This is my input "004|B20A|2008-09-01 00:00:00.000|C|2008-09-01 00:00:00.070|4277" My output should be "004|B20A|2008-09-01 00:00:00.0|C|2008-09-01 00:00:00.07|4277"
1
vote
1answer
71 views

Need help with Perl regex commenting out lines in html

I am trying to comment out a line item entry in a bunch of html documents. I need to match a pattern that has a few variations and the substitution will the be matched pattern surrounded by <!-- -...
0
votes
1answer
37 views

merge values from two files on the same parameters

we have two files - primary.txt and secondery.txt on both files we have the same parameters , but on secondary.txt they are not ordered as the primary.txt more primary.txt param.avarge.com 3443 ...
1
vote
2answers
130 views

Read STDIN with timeout

I want to read STDIN, but at most for 5 seconds. After that I want to process the data I have read so far. select seems to be made for exactly that: Wait until there is input or until timeout. If ...
0
votes
0answers
9 views

How to add additional email validation rules by a python/perl script in Postfix?

In main.cf I have multiple restrictions, as usually: smtpd_NNN_restrictions = # ..... # ..... I want to be able to use an additional python/perl script in each section to make the final ...
0
votes
3answers
110 views

Extract module name and instance name from verilog/System Verilog file

I have a verilog/System Verilog file from which I want to extract only module_name and instance_name. From following single line: module_name #(.ANY_PARAMETER(.ANY_PARAMETER),.ANY_PARAMETER_1(....
0
votes
1answer
55 views

how to separate single json file to pieces of json files

We have the following json ( example 1 ) example 1 more file.json { "version": 1, "partitions": [ { "topic": "list_of_cars", "partition": 2, "replicas": [ 1003, ...
1
vote
3answers
351 views

Replace third word in double quotes from file

This is the json file that we want to edit Example 1 { "topics": [{"topic": "hfgt_kejd_tdsfd”}], "version": 1 } Example 2 { "topics": [{"topic": "hfgt_kj_fsrfdfd”}], "version": 1 } We ...
1
vote
1answer
323 views

Perl - Not a HASH reference or Can't use string (“…”) as a HASH ref while “strict refs” in use

I'm learning Perl. I am able to iterate over a JSON collection using a Perl hash data structure like this using sample data. However, the actual data contains some elements that are causing either the ...
0
votes
1answer
80 views

Can't locate IO/Pty.pm - but it is installed

I have a script that I inherited from another developer and am trying to make it work on a new RHEL server. The script uses Expect.pm which 'uses' IO/Pty (and IO/Tty). The issue is, when I run this ...
0
votes
1answer
125 views

How to use Perl grep on a hash instead of an array?

I'm learning Perl. I have been able to use grep on an array and the syntax is very simple, like this example: use strict; use warnings; my @names = qw(Foo Bar Baz); my $visitor = <STDIN>; ...
0
votes
1answer
45 views

Does it make sense to do these shell operations in Perl instead of Bash?

I'm learning Perl. I have a trivial application that consists of a bash script wrapper around a Perl script. I am thinking about getting rid of the Bash script and doing it all in Perl (as a learning ...
0
votes
1answer
278 views

How to iterate over JSON object collection (not array) in Perl?

I'm learning Perl. I have been able to successfully iterate over a JSON collection when the objects were contained in an array. However, I cannot understand how to work with JSON data where the ...
0
votes
1answer
32 views

extracting column name and using it to output filename

#chr fivep threep strand sample1 sample2 sample3 sample4 name1 name2 chrI 9442 9492 + 0 0 0 0 na na chrI 12584 12631 + 0 0 0 0 na na chrI 12584 ...
0
votes
1answer
73 views

Delete Hundreds of thousands of files by date [closed]

I want a script that can check the age of files in different directories and delete those that exceed an expiration age. There can be hundreds of thousand of files with different creation dates. Some ...
0
votes
2answers
110 views

loop command in a linux file with multiple columns in Perl

I have a file.txt as below with "n" number of columns. I need to run command in loop, that needs to have first column value and the second column value. Upon complete, execute the command to have ...
1
vote
2answers
67 views

Replace multi line string with multi line string without escaping by hand

Say I have a text file text.txt and I want to replace a (multi-line) string that is contained in before.txt with another string that is contained in after.txt, how do I do that? (I dont want to use ...
0
votes
4answers
72 views

merge multiple txt files

I have multiple txt files, 3 of them are like: file1: sample input filtered 5809378 1 2 5811151 3 4 5811237 5 6 file2: sample chi tri 5809378 7 8 5811151 5811237 9 ...
0
votes
1answer
71 views

rename fastq.gz file name

I have hundreds fast.gz files, and they have the same format of file name: 5809029_GWU_DNA_269_L001_R1_001.fastq.gz 5809030_GWU_DNA_269_L001_R1_001.fastq.gz How do I change the first and the second ...
1
vote
1answer
37 views

Cron Issue w/ Some Commands and Perl Script

I have searched the Internet for hours for a solution to my issue, and I can't seem to find an answer or solve what I'm doing wrong. I am trying to set up a cron to run a perl script on a regular ...
1
vote
2answers
63 views

Editing the output of fslint with shell tools awk | grep | sed

The task is to transform this text file, output of the utility fslint, into a bash script with rm command lines for the duplicate file(s) to delete and commented lines for file(s) to keep, according ...
0
votes
2answers
66 views

how to get sed to replace part of a line that start with a range of numbers

How can I get sed or perl to make the following changes to a line from : 41 * * * * /vend/oracle/util/bin/rmp_udump.ksh to: ##SHUTDOWN_MAINT##41 * * * /vend/oracle/util/bin for all lines that ...
0
votes
1answer
39 views

Compiling the output from the Perl Compiler (B::C), I get “EXTERN.h: No such file or directory”

If I try to compile something generated by B::C, $ perl -MO=C,-omyTest.c -e'print "Hello World!";' -e syntax OK And then run `gcc myTest $ gcc ./myTest.c ./myTest.c:3:10: fatal error: EXTERN.h: No ...
1
vote
1answer
96 views

SNMPv3 traps in Zabbix

My question is about zabbix traps with SNMPv3 and snmptrapd service using zabbix_trap_receiver.pl. I have a switch on which I enabled SNMPv3 only, so the switch has no SNMPv1/2c rw or ro communities ...
-1
votes
2answers
48 views

Replace all backslash escape sequence-producable characters with their escaped escape sequences

EDIT: I'm very sorry, that I initially didn't make my requirements clear. I don't actually have access to the string written in a backslash-escaped way and have amended the example to make that ...

1
2 3 4 5
24