Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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
votes
0answers
7 views

Package installing - perl debugger didn't work now works w.o. direct action

Running KALI under WSL. I wanted to debug some perl script but when invoking perl -d was getting something like "perl5db.pl missing" err. After that, not in order to solve that problem but in scope of ...
0
votes
2answers
32 views

How to install Perl modules on Debian 9?

On a tutorial for installing SendEmail, I found instructions to install 2 prequisites, 2 perl modules apt-get install 'perl(Net::SSLeay)' 'perl(IO::Socket::SSL)' This syntax was new for me, and also ...
0
votes
1answer
29 views

How to append line with strings at the end of variable?

We have the following line in file more file USA_FORMAT="-XX:LOP83746=5M -XX:+YU3635-2837" and we want to append the following strings (line) also at the end of USA_FORMAT variable /usr/jdk64/...
0
votes
2answers
95 views

Replace block of text with sed, awk, perl or vim

I am trying to replace every instance of a block of six rows with another block of six rows, just reducing the six rows block of two columns to a six rows block of only one column. Thank you to your ...
2
votes
0answers
33 views

'Out of Memory' on AIX installing Perl Module [closed]

Getting out of memory error trying to install NetFTPSSL perl module on IBM P750 running AIX 7.1 with 76GB of memory. root@polarprod-cip(/)# perl -MCPAN -d -e 'install Net::FTPSSL' Loading DB ...
0
votes
0answers
46 views

Compare two log files line by line and print difference

I have to compare two different log files line by line (in each line data between two symbols (: and ;) is to be checked) and print all lines of log 1 that are not in log 2. If two or more lines have ...
2
votes
0answers
43 views

perl: warning: Setting locale failed

I bought a VPS, Centos 7. However, I was able to understand what was going on with SSH and connected to my WHM. After connecting, I get a list of errors and there is something like this: perl: ...
5
votes
3answers
366 views

sum all numbers from “du”

We want to calculate the first numbers that we get from du du -b /tmp/* 6 /tmp/216c6f99-6671-4865-b8bc-7205f5388752_resources 668669 /tmp/hadoop7887078727316788325.tmp 6 /tmp/hadoop-hdfs ...
1
vote
1answer
39 views

Unix perl match string and delete line

Im using perl to remove a string from a file, it is removing the string from file, But the actual line is not getting deleted, Due to which the next insert to the files are getting written over next ...
1
vote
1answer
43 views

delete lines matching pattern if it is repeated

Say I have a config file: [main] foo = bar [option] opt1 = opt2 opt3 = opt4 [extra] [footer] [tail] print = true [end] I want to print the headers ([text]) only if there are options underneath. So ...
0
votes
1answer
35 views

Looping 'find…-type f': Getting filenames by dir/subdir, ouputing a txt with name dir_subdir_fname.txt

My data structure is something like: dir1/subdir1_level1/subdir1_level2.../subdir1_leveln dir1/subdir2_level1/subdir2_level2.../subdir2_leveln ... Which means that the levels I'm working with are ...
1
vote
2answers
77 views

How can I extract only the pid column and only the pathname column in the lsof output?

$ sudo lsof -u t | grep -i "\.pdf" evince 1788 t 37r REG 8,4 176328 134478 /home/t/some/path1/white space/string1 + string2 string3.pdf evince 3737 t 36r ...
2
votes
1answer
40 views

Perl run command on remote system

I need to run a series of commands on remote systems, but am having problems with perl staying logged in. I "can't" use the ssh or telnet command, as it is a service account logging in and has no ...
0
votes
5answers
115 views

How to replace new line \n and upcoming + sign with space

Replace new line \n and upcoming + sign with space input file ABC + DEF foo + bar Output should be ABC DEF foo bar
0
votes
3answers
88 views

how to remove the empty/blank lines from files that appears as @ from vi

when I open file by vi as vi file Current partition replica assignment @ @ @ @ @ {"version":1,"partitions":[{"topic")] @ @ @ @ @ Proposed partition reassignment configuration but I try to delete ...
1
vote
4answers
64 views

add a new column with sum of columns in perl

I have a huge text file which has below columns col1 col2 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec abc dec 10 20 30 40 50 60 70 80 90 11 12 13 The output I am looking for is an addition of ...
0
votes
1answer
34 views

awk + count the strings from file [duplicate]

I have in file /tmp/users list of users ( each list contain diff users ) Example more /tmp/users root kafka yarn hdfs root root yarn moon apache start moon apache I want to print the users that ...
-1
votes
1answer
51 views

Perl script not found when executed from a different directory than the current one

I am using perl64 on Windows 10 with UWIN installed. I wrote a perl script, sv2jb.pl, which runs fine when invoked under ksh by just typing its name, and when it is in the current directory. I then ...
0
votes
0answers
14 views

How to create separate files based on first column value? [duplicate]

It is tab separated 3 column file. I need to create separate files based on first column value Input: 194501 CAD 1.47421052631579 194517 CAD 1.39578947368421 194520 CAD 0.949473684210526 194501 ...
-2
votes
1answer
57 views

how to match single pattern and replace it with multiple pattern in perl [closed]

i have one file which contain following info - input - a[1]= something_data_1; a[2]= something_data_2; a[3]= something_data_3; so i want to replace that "a" with different pattern like below, ...
1
vote
1answer
90 views

mkdir command not found?

I think I messed up the PATH. I was installing Bioperl and tried to changed path. The correct code should be: $ export PATH=/usr/local/ActivePerl-5.26/bin:$PATH $ export PATH=/usr/local/ActivePerl-5....
1
vote
1answer
22 views

How to prevent from destroying symlinks, using Perl when to replace with sed regex?

Based on How do I prevent sed -i from destroying symlinks?, but I use Perl. I tried by middle of all these questions: Is there a way to make perl -i not clobber symlinks? perl symlink on gz file How ...
1
vote
1answer
30 views

Disable Tomcat Session persistence using sed or perl

I need to disable Tomcat session persistence as I have implemented SpringSession on my Spring (not Spring Boot) Application. I've tried using sed and perl to edit multiple lines in the context.xml ...
1
vote
2answers
60 views

How to start a new column after every nth row?

I have a file (comma separated) on a Linux system with 3 columns. I want to start new column after every 4th row. Input: col1,col2,col3 1,disease1,high 1,disease2,low 1,disease3,high col1,col2,...
0
votes
1answer
20 views

Remove non-alphas while ignoring certain unicode chars

I have a text like the following: []përgjithshme [" është "] 28.748 [< kilometra katrorë.>] This text contains cyrillic characters in the range U400 - U4FF. I want to strip out the non-...
0
votes
0answers
37 views

Script can not write into dierectory

I have configured apache web server on fedora 29 , perl script that generates web page with current NIC information (state , speed , mac , etc.) and traffic graph. Script generates the web page and ...
0
votes
1answer
42 views

tracking segfault upon invocation of perl script (mytop tool and similar)

on my gentoo machine, mytop 1.9.1 quits upon invocation with the following output: # mytop Useless use of private variable in void context at /usr/bin/mytop line 1001. "my" variable $data masks ...
4
votes
3answers
358 views

Manipulating text in first column only? [duplicate]

Example Input: foobar@example.com foo@example.com,bar@example.com Example Output: foobar@example.org foo@example.com,bar@example.com So, in "normal" circumstances, it would obviously be easy to do ...
1
vote
5answers
119 views

Remove text between consecutive occurences of strings

I need to remove all text between two given strings in a text file. The strings may be located on different lines. For instance, in the following text file @article{ginsberg_lifespan_2018, title =...
0
votes
1answer
42 views

how to add words before line on all the scripts in current folder

under /home/scrript , we have 187 bash scripts all the scripts have the following line: kill -PIPE $PID we want to add the following words before this line on all the scripts as the following [[ $...
0
votes
1answer
55 views

Get lines of file matching a regex

Is there a more compact way to get lines of a file that match a regex than the following? open my $fh, '<', $file or die "Cannot open $file: $!"; while ( my $line = <$fh> ) { next ...
0
votes
2answers
198 views

Check which process is using most memory and summary total used memory

by the following command we can check which process is using most memory as we can see the first field show in MB the used for each process is it possible by awk to sum all the numbers and to get ...
0
votes
1answer
51 views

Insert new text in the middle of a file replacing old text without re-inserting the same things over and over?

I have a file that I want to update relatively frequently. What needs to be done is that a specific part of the file would be changed to include some more lines. I am doing it with sed and \a option: ...
0
votes
1answer
120 views

Print line and following text based on pattern matching

I am trying to filter lines from a text file based on patterns in proceeding lines which keeping the pattern matched line. I also need to rename the pattern matched files for example: >text chr1 ...
0
votes
1answer
53 views

Perl script for generating MAC addresses

This perl line very useful to change mac address but retain the first three pair. perl -e 'for ($i=00;$i<6;$i++){@m[$i]=int(rand(256));} printf "00:16:3E:%X:%X:%X\n",@m;' Generate some good ...
4
votes
3answers
301 views

Get one thing from a line and concatenate it with one thing from another line

I have the following: 2018-11-10 23:57:21 [COMMAND]: sar -u 10 5 AIX host 1 7 11/10/18 System configuration: lcpu=64 mode=Capped 23:57:21 %usr %sys %wio %idle physc 23:57:31 ...
5
votes
2answers
335 views

Perl command line regex to modify all pattern matches

I'm trying to use some arithmetic over the matched patterns in perl command line. I'm able to do it for one match but not for all. str="a1b2c3" perl -pe 's/\d+/$&+1/e' <<<"$str" a2b2c3 ...
1
vote
1answer
87 views

Install custom perl modules

I have build an RPM from a proprietary software collection in a CentOS 7 environment but the build process required executing some Perl modules (.pm files) found within the source itself. When I ...
2
votes
0answers
33 views

How do I display file modification time (linux) as “Nov 8 12:00” format? [duplicate]

The format I want is "Nov 8 12:00". It is the format you get by using the ls -l command. It is month, day of the month, hour and minute. I tried stat -c %Y filename which gives time of last data ...
2
votes
1answer
58 views

Can I change terminal type used to login through Net::SSH in perl?

When I login on some particular server through Net::SSH in perl (which I do not have admin access to), I get the following error: %SECURITY-SSHD-4-WARNING_LOGIN : The requested term-type '' is not ...
1
vote
3answers
99 views

Find or extract text between two patterns either on the same line or in many lines

I need to print the text between two patterns without keeping in mind their place as they are found randomly across the file. either in the same line or not in the same line or a text occur between ...
0
votes
1answer
45 views

Replace any string after the last dot with txt string

how to replace any string after the last "." to txt for example filter.bash sum.sh portG.py run.doK.ksh expected results filter.txt sum.txt portG.txt run.doK.txt
1
vote
1answer
33 views

edit names in phylogenetic tree in newick format [closed]

I have a phylogenetic tree in newick format, and I would like to remove some fragments of the name of the taxa, 1_[genus_specie_1]_characters:0.2654682758,(((((((((((((((2_[genus_specie_2]...
0
votes
0answers
252 views

Perl v5.10.0 required--this is only v5.8.8, stopped at ./Configure line 12

when I try to configure new openssl package(openssl-1.1.1), I am getting that perl error.New openssl has dependency on perl version of 5.10.1. My build machine has two versions of perl -5.8.8 and 5.10....
0
votes
2answers
82 views

How to swap two fields inside a JSON file

I have a file like this {"100":["0.00001","10","0.01"], "101":["0.0001","100","0.1"], "102":["1","1000","1"], .... "103":["0.01","10000","10"]} I want to swap the second number with the third, ...
1
vote
3answers
788 views

split string to two parts using sed or awk or perl or bash

I have string like this: Grades ABCDEF-123456 I want to split this string to two sections like this Grades ABCDEF Grades 123456 How can I do that in bash?
0
votes
2answers
59 views

how to print the matching value from same line, which has multiple Delimiter?

I have a File under Linux /tmp/volume.log and the content is: [id:1091666, name:root, deviceName:/dev/sda, maxStorage:107374182400, unitNumber:0, displayOrder:0, rootVolume:true],[id:1091851, name:/...
-3
votes
3answers
135 views

How to grep or search 3 word Patterns in a file and print them along with the content between second and third word Pattern [closed]

How to find or search word PATTERN1 and PATTERN2 and print them both later i want to search PATTERN3 and Print the whole content or section between the search PATTERN2/PATTERN3 (Note Pattern1/2/3 ...
2
votes
3answers
211 views

Filtering list of numbers containing sequential digits

I would like to filter many text files. Each file contain a very long list of numbers. Filtering the files must occur by the number of the consecutive digits within each number. Example list form ...
6
votes
2answers
442 views

Perl script running infinitely - how to debug what happened?

I am running a Perl script on a Linux machine via a cron job. However, from time to time (around 1% of all cases), the script gets stuck and runs infinitely. If I list processes, I can see its PID. ...