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 ...

learn more… | top users | synonyms

1
vote
4answers
66 views

How to convert fixed length fields in a file to space delimited

I have a fixed length matrix type file where each field is 20 characters long. How can I convert this to a space delimited file? Also there are some missing values, which I would like to ...
0
votes
1answer
35 views

Perl/awk/bash: multiply and sum values putting values inline instead original text [on hold]

I have a text like this: ;--------------------------------------- JOURNEY_ARRAY_01 .BYTE <JOURNEY_00 .BYTE <JOURNEY_01 ;--------------------------------------- JOURNEY_ARRAY_03 ...
1
vote
3answers
67 views

multiline editing using perl or any other tool

I'm editing my .uncrustify.cfg file to make it more readable. I just want to reformat like this: Two lines in: # Add or remove between the parens in the function type: 'void (*x)(...)' ...
1
vote
2answers
99 views

Group words based on the value of the first column

I want to group all the file contents based on the value of first column. It would be better if the output is in sorted form. Input: 1 foo 2 bar 1 foobar 2 barbar 3 apple 4 banana 3 mango 5 orange ...
0
votes
0answers
21 views

Row merger due to redunt splits of a single row in Unix

Thanks for your explanation and time Avinash. The code is working as expected but my depiction of problem truned much simpler than the actual problem. Problem: I have a file which has ~5Million of ...
1
vote
4answers
120 views

Sed/awk/perl: reversing order of comma separated values, preserving other text

I have this text: LABEL1 .BYTE 01, 02, 03, 04, 05 .BYTE 01, 02, 03 I need to reverse only comma separated values order: LABEL1 .BYTE 05, 04, 03, 02, 01 .BYTE 03, 02, 01 I need ...
2
votes
1answer
38 views

Replace new line character between two strings

I have problem and see your answer in one of questions suiting with one exception Here is what i am trying to achieve \n (new line character) has to be replaced with blank when \n is between two \" ...
0
votes
1answer
22 views

OSD notification for Irssi

I want to get a notification each time I get a /query message or get highlighted in a channel. this notification should be in the form of bubble OSD (on screen Display). If OSD isn't possible for ...
1
vote
1answer
49 views

count matches and mismatches group by

Please help with a shell script of the following. I need count number of consistent variables in each lane (col1) across samples (col2). For example, since all the values (col4) of lane1 variable 1 ...
2
votes
2answers
39 views

Sed/awk/perl: modify text preserving parts and align to a column

I have a text like this: A1JOURNEY0TO1 .BYTE 00, 00, 00 A2JOURNEY0TO2 .BYTE 00, 01, 00 A3JOURNEY1TO0 .BYTE 00, 01, 01 I need to have: JOURNEY_01 ; 00 TO ...
1
vote
1answer
53 views

Perl plugins don't work on my rxvt-unicode! [closed]

I wanted to add some features to my urxvt so I changed my .Xresources file. for the global effect of plugins I copied them all to /usr/lib/urxvt/perl. but still no multi tab, clickable link or ...
-1
votes
1answer
38 views

How to remove only 0-9 character long numbers from a file?

How can we remove only the numbers that are 0,1,2,3,4,5,6,7,8,9 character long from a file? I mean the lines that are matching this pattern. Example for removable lines: cat input.txt 1 123423113 ...
0
votes
1answer
57 views

Cut a specific part of a column from a csv file [closed]

I have to process a csv containing about 15 columns one of which contains a particular timestamp that includes milliseconds. When I go to insert this csv into a DB, I get an error because of this ...
1
vote
0answers
24 views

How can I send email without using uuencode and mute?

Is it possible to send attachment from unix/AiX without using uuencode and MUTE command? We can write a Perl script which will send email properly but without attachment, can I get the perl code ...
1
vote
1answer
43 views

How to write this replacement with condition

I want to replace now within my working directories the word -> with $\to$ if the word is not within verbatim environment. Pseudocode Replace all entriens of -> with $\to$ everywhere else but not ...
1
vote
1answer
49 views

Regex works in shell but not through Perl script

I'm having trouble executing a Perl script through the Unix shell using Perl's system command. I've had more complex regex commands I had to adjust accordingly to convert from Unix to Perl, and ...
3
votes
2answers
89 views

How to write this pseudocode where condition

This question is extension of this question about listing questions of directories. I get a problem that I need to understand the original section of the text. Current output where you see the ...
0
votes
2answers
39 views

To match only innermost environment by Regex

I want to match the innermost environment of begin{question} and its corresponding end{question}. Example data \section{Takayasu arteritis} \begin{question} {You get a patient. What do you notice ...
2
votes
1answer
93 views

grep search expression and rename file

I have readable pdf files that all contain the string VAX followed by eight numbers, like VAX00002885. Now I want to find that expression and rename the corresponding pdf to VAX00002885.pdf (in this ...
1
vote
1answer
29 views

Perl one-liner for replacing values greater than a threshhold

I have a text file which contains 7 columns of floating point values (). I would like to use perl one-liner and find the values which are greater than a threshold in the 7th column. Then, I want to ...
-2
votes
1answer
775 views

convert CSV to XLS file on linux [closed]

The following Perl script can convert CSV file to XLS file the problem is that I need to install on customer Linux machine many Perl modules in order to run this Perl script , and actually I cant ...
0
votes
5answers
49 views

df -k + how to match the root volume line

please advise how to match the "/" volume from df -k command? I tried the following: [root@machine /]# df -k | grep "/" /dev/vx/dsk/bootdg/rootvol 130926685 71378710 58238709 56% / /devices ...
2
votes
2answers
284 views

echo test | stty -echo -> stty: standard input: Inappropriate ioctl for device

I was playing with a perl script that takes user input with the following: system( qw( stty -echo ) ); $? == 0 or die "Error unable to disable character printing.\n"; print "$prompt: "; my $input = ...
2
votes
1answer
50 views

Why does mysql server packages have perl dependencies in linux distros?

I'm trying to clean out some unneeded packages from one of my gentoo boxes with emerge --depclean, and I thought I had a few perl modules installed that none of my wanted packages should require. So, ...
-1
votes
1answer
35 views

search for a character in one column and replace value in another column of matched records

I have a requirement to find value 2 in column 4 and wherever it matches replace 6th column with '-'sign in the beginning suppose if i have csv file - file1 like this abc,0,def,1234,ijk ...
0
votes
3answers
73 views

Combinatorics of letters and words - preferably bash, will accept perl or other [closed]

I am trying to write a shell script to generate all possible words in the English language less than 20 characters. I doubt there is any truly efficient way to do this other than to brute force some ...
0
votes
1answer
57 views

Uuencode displaying attachment content in email body

I am using uuencode with mailx to attach a zip file. In following code, the if block works perfectly and I get Deletions.zip as an attachment in the email. But, whenever the else block is executed I ...
0
votes
0answers
36 views

Folding in vimrc does not work as expected

I added these to my vimrc: set foldenable set foldmethod=syntax set foldlevelstart=1 let javaScript_fold=1 " JavaScript let perl_fold=1 " Perl let php_folding=1 ...
0
votes
3answers
45 views

How to Print certain Fields if a condition is met

I have a big Input file as shown below. If "PRIMER_LEFT_NUM_RETURNED" is not equal to 0 then print the corresponding SEQUENCE_ID, SEQUENCE_TEMPLATE,PRIMER_LEFT_NUM_RETURNED, PRIMER_RIGHT_NUM_RETURNED, ...
1
vote
1answer
75 views

calling script from perl/python/ruby and retrieving output [closed]

I inherited a tcsh "master" script that works and extracts lines from files with data with using 'zcat' piped to 'grep' and some other commands/scripts. The extracted lines contain numbers . It is ...
3
votes
3answers
348 views

Replacing string in all files found by grep. Can't get it to work

I'm trying to do what title says. So I find all needed files with grep: grep --include=\*.{php,ini,conf,sh} -ril -P "'([\d\w\-\_\.]+)(@domain.com)'" '/var/www_data/somepath/' Now I assume it's ...
3
votes
4answers
53 views

Need to remove - (Minus) sign at the end in number from many columns and insert it on columns removed

I have a huge csv file which has - (Minus) sign at the end of numbers. Now I need to move these - minus signs to begin of the numbers, i.e I need to remove the last character if it has '-' sign and ...
-1
votes
2answers
59 views

How to remove a newline character in a particular line through perl?

I want to remove a newline character in a particular line through perl one-liner command. Input: 1407233497,1407233514,bar 1407233498,1407233515,foo mingstats&fmt=n 1407233499,1407233516,foobar ...
1
vote
3answers
36 views

Concatenate Sequences under a Heading

I have a file like File1. With a heading for example ">Contig1" and I want to concatenate all the sequences under the respective heading. File1: >Contig1 ACCCCATACATCCAAA NNNNNNNNNNCATACA ...
3
votes
1answer
51 views

Handling dynamically changing column positions and splitting file

I have a unique problem. I have a file with following columns PersonId, AB1, AB2, AB3, DG1_B1,DG1_B2,DG2 1,0,1,0,3,5,7 2,0,3,1,3,7,4 I want to split this and create multiple files based on the ...
0
votes
1answer
32 views

Kill a Process for a User [closed]

chomp $choice; if ($choice == 5) { print "**********************************\n"; print " Enter the User Name\n"; $user_name = <STDN>; sub kill_processes { $user_name = ...
2
votes
3answers
34 views

Delete until given character starting from given string

root@server:~/foo$ cat INPUT.txt limit. Current u'^'ZO limit. Current usage'^'FR limit. Current us'^'AS limit. Current usage 95 %.'^'FR limit. Cur'^'AEW root@server:~/foo$ sed ...
0
votes
0answers
95 views

Unable to install Crypt::SSLeay perl module on RHEL 5.7 (x86_64)

Here is the scenario, actually my RHEL 5.7 (x64_86) server don't have internet connection. but I want to install Crypt::SSLeay perl module on that server. So I downloaded it from CPAN & then ...
4
votes
1answer
41 views

grep variable-length optional text

I would like to search for edge-anchored text that has a block of preceding optional text, any amount of which can be included in the match. For instance, supposing I am trying to find ^xyz but would ...
0
votes
1answer
63 views

Bandwidth speed test with nginx

I have server with nginx-1.4.1. I want to test bandwidth between my desktop and server. Incoming speed I can test by simple download file with size 10M from server and count time what I need to ...
0
votes
2answers
252 views

how to remove all double quotes from csv except specific field

I want to remove all double quotes from my csv but not the fourth field (because the four fields represent PATH of file) Please advice how to implement this by sed or awk or perl one liner , etc ...
1
vote
1answer
444 views

“Requires: perl(:MODULE_COMPAT_5.8.8)”

I use CentOS 6.5 for my server with below repository: IUS epel ces-standard-* base/upgrade/extras When I tried to update today (it's been a while I haven't updated this server), I got the ...
5
votes
2answers
285 views

How is the inplace modification of a file being done?

What does the "inplace" modification of a file e.g. via sed -i or perl -i mean? My question is about how this inplace modification is done. Is the file copied the modification is done in the copy and ...
2
votes
2answers
139 views

Format the content of the file using Perl

I am new to Perl programming and I am stuck with this problem for some time. Can you please help me in solving it? I have a file with the following format: >Country1 Aus trali a >Country5 ...
5
votes
1answer
41 views

Count duplicate rows with constraint

I have the following file: A B 1990 A C 2001 A C 2013 A B 2001 B C 2013 A D 2001 A D 2014 I need to count duplicate pairs (in the 1st and 2nd column) and to each such pair assign the lowest value ...
4
votes
2answers
76 views

Get the maximum sum for a file on 2 keys

I have a file as below. key1 key2 key3 a1 2 l1 a1 2.5 l2 a2 2 l2 a3 2.5 l3 a3 2.1 l4 a3 2.2 l5 I am trying to find the maximum possible sum of key2 that satisfies the ...
0
votes
0answers
65 views

zip command is failing during high memory usage

We have several perl scripts, which generates and emails reports. The script that emails the files expects a .zip extension. The report scripts generates a .txt or .xls file and then runs the ...
3
votes
4answers
148 views

How to sort with a delimiter that is several characters long?

INPUT: $ cat a.txt 1FOO2FOO3 4FOO5FOO5 2FOO1FOO9 $ OUTPUT: $ cat a.txt | sort SOMEMAGIC 2FOO1FOO9 1FOO2FOO3 4FOO5FOO5 $ Question: How can I sort, if I have a several character long ...
0
votes
0answers
56 views

Install application on barebone linux board without internet

I'm kind of new to using linux for hardware development. I made a C program which uses ExifTool, and it works fine on the desktop. The ExifTool have to be installed and runs on Perl. I can cross ...
3
votes
1answer
484 views

Convert xml subtitle file to srt format

I have a xml subtitle that looks like this: <?xml version="1.0" encoding="utf-8" ?><transcript> <Item from="1.16" duration="4.68"><![CDATA[(Dong-hyuk is coming to see you now.) ...