We’re rewarding the question askers & reputations are being recalculated! Read more.

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
-1
votes
1answer
18 views

NGINX - How to export the entire server block for a given domain

I need a tool or one-liner or whatever, which will export the entire server {...} block containing the given domain. For examples: ### 1) cat conf.d/domains.conf server { include http.conf; ...
0
votes
0answers
34 views

Use Perl to extract multiple arrays and iterate specified arrays

I have a question on Perl. I need to extract arrays and print in the columns below. The tricky part is that each word has different pronunciation types (which is specified in P or S) and each type is ...
0
votes
2answers
54 views

Extract arrays followed with corresponding matches

I am very new to Perl. I need to extract arrays and print in the columns below. The tricky part is that each word has different pronunciation types ( which is specified in P or S) and each type is ...
2
votes
2answers
1k views

Veritus volume manager perl not avaliable

I am trying to install veritas volume manager on Centos 6.5 while running the script its throwing me Cannot find perl to execute
1
vote
0answers
49 views

malware identification found on ubuntu server

I discovered a script running on my server. Reading through apache log files, attacker used cms login vulnerability and downloaded script from this site http://217.61.107.9/wes. Can anybody identify ...
0
votes
4answers
54 views

how to remove New line character using Sed or perl [duplicate]

I have a huge file of XML data containing the lines like <fonts> some of the data </fonts> <fonts> some of the data </fonts> <fonts> some of the data </fonts> <...
3
votes
1answer
1k views

Modify filenames in Makefile

For reasons that are not important here, I have a source code that I process automatically file-by-file and the processed source files are renamed in a systematic manner. For example, I start out with ...
5
votes
0answers
72 views

How to create a custom Perl distribution

I would create a custom Perl distribution for perl-5.30.0.tar.gz. I would include in the perl-5.30.0.tar.gz following Perl modules HTML::Entities HTML::Strip Devel::CheckLib Net::DNS Mail::DKIM::...
2
votes
1answer
1k views

SFTP Dual Factor Authentication

My Issue I am trying to automate a file fetch from an external [SFTP] server. The server is using 2-factor authentication. First, it needs a public-private key pairing established [This has already ...
40
votes
6answers
80k views

How do you list number of lines of every file in a directory in human readable format.

I have a list of directories and subdirectories that contain large csv files. There are about 500 million lines in these files, each is a record. I would like to know How many lines are in each ...
27
votes
13answers
15k views

Converting CSV to TSV

I have a number of large CSV files and would like them in TSV (tab separated format). The complication is that there are commas in the fields of the CSV file, eg: A,,C,"D,E,F","G",I,"K,L,M",Z ...
1
vote
1answer
70 views

inplace file replacement for nth pattern match

I have a file with many lines but I can summarise my requirements like below: <DT><A HREF="http://127.0.0.1:1234/ABCDE/wp-admin/index.cfm?event&msg=secure&fr=sp">...
25
votes
8answers
41k views

How to delete the last column of a file in Linux

I want to delete the last column of a txt file, while I do not know what the column number is. How could I do this? Example: Input: 1223 1234 1323 ... 2222 123 1233 1234 1233 ... 3444 125 0000 5553 ...
3
votes
2answers
67 views

Bugzilla error: Can't locate object method quit via package “Net::SMTP::SSL” line 365

I installed Bugzilla on my CentOS 7 web server VPS. The install went smoothly, however when I went to set up email, I received the following error: Can't locate object method "quit" via package "...
0
votes
0answers
30 views

Why is rpmbuild failing to build a noarch package?

I am trying to build an RPM of perl-Net-SNMP-XS for RHEL 7 (as I can't find a prebuilt RPM anywhere) I followed this https://www.cyberciti.biz/faq/build-perl-module-rpm-file-with-cpanspec-on-rhel-...
0
votes
3answers
45 views

sed + set value inside double quotes

The file is like this more /etc/sysconfig/chronyd # Command-line options for chronyd OPTIONS="" We need to set the value -4 inside "" The file looks like the following, # Command-line options for ...
1
vote
3answers
76 views

Why is my perl regex in my bash script not working? MacOS Terminal

I'm trying to move away from AppleScripts for workflows at my job, and create something simpler that can run in the background instead. For this task, I am given 35-40 files (5 renditions of 7 or 8 ...
1
vote
1answer
49 views

Maximize coverage of a dataset

I have a dataset of the following format. Field 1 lists an identifier, field 3 lists data points, and field 2 counts those data points. id1 5 E1, E2, E3, E4, E5 id2 4 E3, E4, E5,...
-4
votes
2answers
35 views

Create multiple random pairwise combination of words [closed]

File 1 contains the list of words that needed to be randomly paired Tiger Cat Fish Frog Dog Mouse Elephant Monkey File 2 contains the pairs that should not be used (in any solution) during random ...
0
votes
3answers
63 views

how to find the maximum value in specific column every for example 5 lines

How to find the maximum value every 5 lines in a large file. I have file like for example: 186 5 24.0772 24.061 18.5996 2.14E+06 123 4 25.838 29.4805 25.8075 1.25E+06 47 4 24.0637 27....
761
votes
8answers
1.5m views

How can I replace a string in a file(s)?

Replacing strings in files based on certain search criteria is a very common task. How can I replace string foo with bar in all files in the current directory? do the same recursively for sub ...
15
votes
4answers
31k views

How to open terminal, split to 9 terminals and switch between them using one script?

I would like to open a terminal, split it to lets say 9 parts (3x3) and execute some bash script. But for each terminal part different script. Can this be done using perl, python or even bash? How ...
0
votes
0answers
15 views

Is it possible to install smtp-user-enum on macOS?

I'd like to see if there might be a workaround to install smtp-user-enum on macOS, or does it only have to be installed on Linux? I'm copying the installation part of the documentation below, not ...
0
votes
1answer
2k views

How to submit multiple commands as one liner in netbatch nbq commmand line

Can someone tell how to submit a one liner command using nbq command line? Submitted multiple commands in Linux works fine but not in nbq mode as below. find /nfs/disks/test_dir/ -name .snapshot -...
0
votes
0answers
27 views

FreeRADIUS Perl Module “Unknown or invalid value ”perl“ for attribute Auth-Type”

I am attempting to setup a FreeRadius Server with an OTP (LinOTP) backend in Centos 7. My issue is loading a perl module needed to link FreeRADIUS to LinOTP. No matter what I try I just keep getting ...
4
votes
3answers
847 views

How to add the real hostname in the beginning of Linux cli command [duplicate]

we have redhat servers - 7.2 the following output from sar print all relevant details as the following sar -p -d 1 1 07:16:35 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz ...
1
vote
1answer
48 views

How to find max value from specific XML element using a Perl one liner?

I have an XML file with the following syntax <element> <id>0</id> <tag1>something</tag1> ... <tagn>something</tagn> </element> <element> ...
-1
votes
3answers
59 views

Mapping readings with labels [closed]

Given a list of readings in the following format: 1 1 0 0 2 3 23101 23101 0 0 2 0 5 2 0 0 1 1 0 0 2 2 23104 23104 0 0 1 0 5 1 0 0 What would be an approriate (and clean !) way to map them to their ...
8
votes
5answers
1k views

Removing rows containing NA in every column

I have a tab delimited file which looks like this: gene v1 v2 v3 v4 g1 NA NA NA NA g2 NA NA 2 3 g3 NA NA NA NA g4 1 2 3 2 The number of fields in every line is fixed and ...
1
vote
2answers
752 views

How to avoid undesirable dependancies in rpm package?

I am making a package for RHEL7. When I try to install the package, I get # yum localinstall mypackage-0.0-1.el7.rpm (...) --> Running transaction check ---> Package webmin-GPI-init.noarch ...
2
votes
2answers
80 views

Does the order of command line options matter in Perl?

The following command works as expected: perl -lne 'print $1 if /install\(TARGETS (.*) RUNTIME DESTINATION bin\)/' CMakeLists.txt This one works as well: perl -nle 'print $1 if /install\(TARGETS (.*...
-2
votes
2answers
58 views

command to summarize a cluster of entries in a table

I have a table that shows how many ASVs(columns) are clustered in one OTU(rows). Each ASV is represented by a value of 1. #OTUID ASV_1 ASV_2 ASV_3 ASV_4 ASV_5 ASV_6 ASV_7 ...
0
votes
0answers
68 views

Why might a perl CGI script fail to connect to MySQL, when it works from console?

I'm migrating to new server hardware, which also means learning the idiosyncrasies of a new Linux distribution (Debian buster). I've got a Perl CGI script which when run from the console runs, but ...
0
votes
1answer
1k views

how to print only Difference in two files using NR=FNR?

we have to print the old entries only Delta(Difference) in File-1 and File-2. newly added enties in files-1 no need to print. on my unix server everyday new report is extracted from system which is ...
3
votes
4answers
354 views

Extract specific characters from each line

I have a text file, and I want extract the string from each line coming after "OS=" input file line A0A0A9PBI3_ARUDO Uncharacterized protein OS=Arundo donax OX=35708 PE=4 SV=1 K3Y356_SETIT ATP-...
0
votes
2answers
85 views

Replace a command with the result (command output) in the line using sed

Is it possible to replace a command extracted by some regex with its output using sed? For example, I have the next file: 2 + 2 = $$shell:echo 2 + 2 | bc$$ // and "some unescaped text' here how I ...
0
votes
2answers
51 views

merge 1st column and 2nd column; 3rd and 4th column and so on with a separator

I have a text file with 61000 columns and 173 rows. I would like to merge data on every 2 columns i.e., columns 1 and 2 should be merged, 3 and 4 should be merged, 5 and 6 should be merged and so on. ...
4
votes
1answer
85 views

Printing PDF using Perl

I've got a script that creates a PDF and sends it to remote print server running CUPS. Using Net::Printer, I set up the printer: my $print_server = "remote_print.server"; my $printer ...
1
vote
2answers
29 views

Unable to use Perl join properly to append something to each occurrence - getting “Array found where operator expected at” error

I have log lines like these - /mnt/internal-app/logs/internal-app.log_2019-08-21.log.gz:2019-08-21 07:31:14,153 5458142 [XNIO-3 task-4] INFO c.c.p.i.m.ws.FileManger [FileName.java:1838] - UUIDs in ...
0
votes
1answer
899 views

Comparing two text files and printing out matching ids, sub_ids and timestamp related to the id

I found this solution in Perl interesting. I have a similar situation to print matching columns and two additional columns from the second file (Rev ID n date released). How do I read both files from ...
2
votes
1answer
46 views

compare columns from two different files and PRINT RECORDS FROM FIRST FILE those that DO NOT match from second file

I would like to compare columns from file one to two. Where column 2 of file1 should un-match from column 1 or 2 from file2 and print output from file 1. file1. cat test.head20.R2.fastq.tab @...
1
vote
3answers
24 views

insert strings/words to variable from file and join separator instead of space/s

We have the following file ( it is example ) more machines.txt Node23 Node34 Node12 Node95 Node23 We want to insert the list of all node to variable and join each node with “,” separator Example ...
3
votes
3answers
38 views

Rename to remove everything after a special character

I recently discovered the perl-based rename function but since I don't know anything about perl I can't use it properly. I found of a lot of question about the subject but nothing helped me. I would ...
-2
votes
4answers
8k views

how to check for disk in use on rhel

How to check if a disk is in use? If in use, How to check free, used space before I can start using it? I'm trying this in Perl and Any help is appreciated.
0
votes
1answer
43 views

Autostart pure-ftpd by running its Perl configuration file at the command line

I have manually built the pure-ftpd on my Raspberry Pi and it runs perfectly fine when I invoke /etc/pure-config.pl /etc/pure-ftpd.conf from the command line. I'd like to run that simple command /...
2
votes
3answers
3k views

Failed dependencies trying to install package 'libxml2'

I am trying to install libxml2, but my system complains about dependencies. The dependent packages exist on system. The ultimate goal is to install xml_grep2, I have been trying various methods (cpan,...
3
votes
7answers
552 views

Print only the last three columns from file

I have this file on Linux: 14:00:01.071 5255 604177 4 14:00:01.074 4608 1415742 14:00:01.074 18398 1122001 2 14:00:01.074 11723 155575 5 14:00:01.075 4695 885808 Desired Output: 14:00:01....
2
votes
2answers
6k views

Missing shell module in perl 5.18

I'm running Perl script under SLES 12 which has Perl 5.18 installed. When trying to run my Perl script I get an error: Can't locate Shell.pm in @INC (you may need to install the Shell module) (@INC ...
1
vote
0answers
40 views

Computing pair-wise time differences in mili seconds between matching records in a data table

I have a three-column table of data of the following form: TIME MPID CPID 14:00:04.909 10048 370007 14:00:05.320 10048 370007 14:00:05.462 10048 370008 14:00:05.761 10048 370008 14:00:...
1
vote
5answers
84 views

Editing a file in place using perl or awk

I have a large tab-delimited input file listed as below SF_0000000555_RDNAU_58_10293 10873 11041 + ID=match41;Target=SF_0000000005 99 267 168 SF_0000000555_RDNAU_58_10293 188079 ...