Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

-4 votes
5 answers
105 views
Perl or sed script to remove a specific content of a file from another bigger file
I have a file **(FILE1)** with some repeated sections as below (example): LINE 1 ABCD LINE 2 EFGA LINE 3 HCJK REMOVE LINE11 REMOVE LINE12 REMOVE LINE13 LINE 4 ABCDH LINE 5 EFGAG LINE 6 HCJKD REMOVE LINE11 REMOVE LINE12 REMOVE LINE13 LINE 7 ABCDH LINE 8 EFGAG LINE 9 HCJKD I have several such files. I...
I have a file **(FILE1)** with some repeated sections as below (example): LINE 1 ABCD LINE 2 EFGA LINE 3 HCJK REMOVE LINE11 REMOVE LINE12 REMOVE LINE13 LINE 4 ABCDH LINE 5 EFGAG LINE 6 HCJKD REMOVE LINE11 REMOVE LINE12 REMOVE LINE13 LINE 7 ABCDH LINE 8 EFGAG LINE 9 HCJKD I have several such files. In a pattern file (**PATTERN**) I have these removable lines stored. REMOVE LINE11 REMOVE LINE12 REMOVE LINE13 I want to write a sed, awk (bash code) or a Perl code to remove all the sections of of **FILE** that match the content of the file **PATTERN**. Another requirement is to remove all but leave the first occurrence only.
Pratap (45 rep)
Aug 6, 2025, 06:03 AM • Last activity: Aug 7, 2025, 03:11 AM
1 votes
1 answers
1882 views
Downgrade Perl Version 5.16.3 on RedHat 7 to 5.10.1
I'm making a migration of my monitoring application from a redhat 6 server to a redhat 7 server. There are perl plugins I have on the redhat 6 server that work. But when migrated to redhat 7, they dont. The package in question here is **perl-DBD-Sybase.x86_64 1.10-1.el6.rf** Im able to install this...
I'm making a migration of my monitoring application from a redhat 6 server to a redhat 7 server. There are perl plugins I have on the redhat 6 server that work. But when migrated to redhat 7, they dont. The package in question here is **perl-DBD-Sybase.x86_64 1.10-1.el6.rf** Im able to install this package on redhat 7 (there doesnt appear to be a redhat 7 version of it - at least, i havent found one). And when I install the package and try to use the plugin that uses the package, I get the following error: [/usr/bin/perl: symbol lookup error: /usr/lib64/perl5/vendor_perl/auto/DBD/Sybase/Sybase.so: undefined symbol: Perl_Istack_sp_ptr] Do i have any other alternative to dealing with this? how can i resolve this so it works on redhat 7?
swenson (11 rep)
Aug 21, 2017, 03:53 PM • Last activity: Aug 1, 2025, 10:08 PM
6 votes
5 answers
1500 views
Summing rows in a new column using sed, awk and perl?
I have a file that contain numbers something like: 1 11 323 2 13 3 3 44 4 4 66 23 5 70 23 6 34 23 7 24 22 8 27 5 How can I sum the rows and output the results in a column, so the results are as follows: 1 11 323 335 2 13 3 18 3 44 4 51 4 66 23 93 5 70 23 98 6 34 23 63 7 24 22 53 8 27 5 40 I would li...
I have a file that contain numbers something like: 1 11 323 2 13 3 3 44 4 4 66 23 5 70 23 6 34 23 7 24 22 8 27 5 How can I sum the rows and output the results in a column, so the results are as follows: 1 11 323 335 2 13 3 18 3 44 4 51 4 66 23 93 5 70 23 98 6 34 23 63 7 24 22 53 8 27 5 40 I would like to see solutions in sed, awk, and perl
user311543
Sep 19, 2018, 03:07 PM • Last activity: Jul 14, 2025, 02:54 AM
4 votes
5 answers
5992 views
Print only unique lines from file not the duplicates
I have a sorted words list, line by line file like so: apple apple grapes lime orange orange pear pear peach strawberry strawberry I only want to print out unique lines and drop duplicates: grapes peach lime How can I do this with `sed`, `awk` or `perl`?
I have a sorted words list, line by line file like so: apple apple grapes lime orange orange pear pear peach strawberry strawberry I only want to print out unique lines and drop duplicates: grapes peach lime How can I do this with sed, awk or perl?
user155704
Feb 9, 2016, 02:36 PM • Last activity: Jun 16, 2025, 01:34 AM
0 votes
2 answers
2672 views
Need to pass arguments in adcfgclone.pl script
I just wanted to know is there any way to pass the arguments in perl script (`adcfgclone.pl`) during compilation time (i.e., the values should not be asked during script run time) Below is an example that i am passing the values after running the script. Provide the values required for creation of t...
I just wanted to know is there any way to pass the arguments in perl script (adcfgclone.pl) during compilation time (i.e., the values should not be asked during script run time) Below is an example that i am passing the values after running the script. Provide the values required for creation of the new APPL_TOP Context file. Target System Hostname (virtual or normal) [proddb] : Target Instance is RAC (y/n) [n] : n Target System Database SID : proddb1 Target System Base Directory : /d06/oravis Target System utl_file_dir Directory List : /usr/tmp Number of DATA_TOP's on the Target System : 1 Target System DATA_TOP Directory 1 [/d01/oravsn12/db/apps_st/data] : /d06/oravis/db/apps_st/data Target System RDBMS ORACLE_HOME Directory [/d06/oravis/db/tech_st/10.2.0] : /d06/oravis/db/tech_st/10.2.0 Do you want to preserve the Display [null] (y/n) ? : n Target System Display [sharkap:0.0] : Target System Port Pool [0-99] : 34 Note: I am entering all the above values during the script run time, so i just pass those all arguments in one file and just run the adcfgclone.pl script.
Maheswar (1 rep)
May 30, 2017, 07:25 AM • Last activity: May 19, 2025, 11:04 AM
0 votes
1 answers
1027 views
bash + grep only the time stamp from output
we want to capture the time from the output and not the time from the command sshpass expected output Sun Jul 14 12:47:49 UTC 2019 Sun Jul 14 12:47:49 UTC 2019 Sun Jul 14 12:47:49 UTC 2019 but from the command we get: sshpass -p customer pssh -H "presto01 presto02 presto03" -l root -A -i "date" | gr...
we want to capture the time from the output and not the time from the command sshpass expected output Sun Jul 14 12:47:49 UTC 2019 Sun Jul 14 12:47:49 UTC 2019 Sun Jul 14 12:47:49 UTC 2019 but from the command we get: sshpass -p customer pssh -H "presto01 presto02 presto03" -l root -A -i "date" | grep '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]' 12:45:45 [SUCCESS] presto01 Sun Jul 14 12:45:45 UTC 2019 12:45:45 [SUCCESS] presto03 Sun Jul 14 12:45:45 UTC 2019 12:45:45 [SUCCESS] presto02 Sun Jul 14 12:45:45 UTC 2019 we can do sshpass -p customer pssh -H "presto01 presto02 presto03" -l root -A -i "date" | grep '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]' | grep -v "^\[" Sun Jul 14 12:50:24 UTC 2019 Sun Jul 14 12:50:24 UTC 2019 Sun Jul 14 12:50:24 UTC 2019 but this is ugly way
yael (13936 rep)
Jul 14, 2019, 12:50 PM • Last activity: May 15, 2025, 10:57 PM
1 votes
2 answers
7386 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][1] using sample data. However, the actual data contains some elements that are causing either the error `Not a HASH reference` or `Can't use string ("...") as a HASH ref while "strict refs" in...
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 error Not a HASH reference or Can't use string ("...") as a HASH ref while "strict refs" in use. Here's a simplified example of problematic data that is giving me trouble: { "0y7vfr1234": { "username": "user1@example.com", "password": "some-random-password123", "uri": "ww1.example.com", "index": 14 }, "v2rbz1568": { "username": "user3@example.com", "password": "some-random-password125", "uri": "ww3.example.com", "index": 29 }, "active": "0y7vfr1234", "0zjk1156": { "username": "user2@example.com", "password": "some-random-password124", "uri": "ww2.example.com", "index": 38 }, "logging": { "active": true } } **I am only concerned with the data elements that have a uri. I want to skip over the others. How would I do that?** After trying dozens of things that did not work (and only led to new or different errors), here is how I finally got around the errors. However, I assume there is a much better way to do it than using ref(). #!/usr/bin/perl use JSON; use utf8; use Data::Dumper; use strict; use warnings; my $data = '{ "0y7vfr1234": { "username": "user1@example.com", "password": "some-random-password123", "uri": "ww1.example.com", "index": 14 }, "v2rbz1568": { "username": "user3@example.com", "password": "some-random-password125", "uri": "ww3.example.com", "index": 29 }, "active": "0y7vfr1234", "0zjk1156": { "username": "user2@example.com", "password": "some-random-password124", "uri": "ww2.example.com", "index": 38 }, "logging": { "active": true } }'; my $json = decode_json($data); foreach my $key (keys %$json) { if ( ref( $json->{$key} ) !~ m/HASH/ ) { print "[" . ref( $json->{$key} ) . "]: skipping\n"; next; } if ( ! exists $json->{$key}->{uri} ) { print "Not a server. It's type is: [" . ref($json->{$key}) . "]\n"; print "Without curly braces: $json->$key\n"; print Dumper($json->{$key}); print "With curly braces: $json->{$key}\n"; next; } print "checking $json->{$key}->{uri}\n"; # do some other stuff } The code more or less works as is, but I'm not happy with it... or my understanding of it. My questions are: 1. What is the right way to iterate over "mixed" data like my JSON without encountering errors? 2. What is a good way to display some information about the elements that I skip? I tried various things in the code (Data Dumper, printing without curly braces, etc.) and none of them are satisfactory. Is there a better way I can show information about what was skipped (without causing an error, of course)? 3. Why does the above code $json->{$key}->{uri} also work without the arrow like this: $json->{$key}{uri}? I'm using perl 5, version 30 on Linux.
BugBuddy (668 rep)
Dec 17, 2019, 08:59 PM • Last activity: May 7, 2025, 06:30 PM
0 votes
4 answers
224 views
regex to detect two consecutive lines that have the same words in the same order, but different spaces at leading, trailing and between words
I want to find a regex or perl oneliner to detect two consecutive lines that have the same words in the same order, but the leading spaces, trailing spaces and amount of spaces between the words may vary from one line to the other. The regex must exclude thos lines that don't match. I use this regex...
I want to find a regex or perl oneliner to detect two consecutive lines that have the same words in the same order, but the leading spaces, trailing spaces and amount of spaces between the words may vary from one line to the other. The regex must exclude thos lines that don't match. I use this regex to detect thw identical consecutive lines
^\s*(.*\S)(\s\n*\1)+$

It fails when the amount of whitespace vay from one line to the other. I have this sample text Mary has a little lamb. The live near the mountain. Mary has a little lamb. The live near the mountain. vrfgrgru hfiughf iujhfuihgifughuir nuhuvhfug Mary has a little lamb. The live near the mountain. Mary has a little lamb. The live near the mountain. Mary has a little lamb. The live near the mountain. Mary has a little lamb. The live near the mountain. fghurhg bojghirejyohi ndhguhyituhgi gbshbsiughsf bnighriugh hurhgiurhgriu Elvis was the greatest singer of all time. He has 18 number one in billboard charts. Elvis was the greatest singer of all time. He has 18 number one in billboard charts. sgfuhgdugusd vfjsng orjgoergo ejfio dsmnjn fbdhsbfgdbhhbfhdsfdf Mary has a little lamb. The live near the mountain. Mary has a little lamb. The live near the mountain. gsete gerttrb oijoijoijoijoijoiojo gogoerijoi jhoiyrei erogjrijgtrio noifdo mkooi This has been the coldest winter in the last 20 years. This has been the coldest winter in the last 20 years. Regardless of the number of spaces in the lines, the regex should display the consecutive lines that contain the same information. There aren't three in a row and there aren't empty lines between the matching lines.
Sistemas Libsur (75 rep)
Sep 16, 2024, 06:41 PM • Last activity: May 1, 2025, 10:03 AM
8 votes
4 answers
1803 views
Why do my UTF-8 filenames always match against a regex bracket expression in Perl?
Here is a script to fix broken Cyrillic filenames if the files were moved to Mac from Windows (based on an answer to https://unix.stackexchange.com/q/792464) ```perl #!/bin/zsh # Usage: # Requires Perl::Rename find "$1" -mindepth 1 -print0 | rename -0 -d -e ' use Unicode::Normalize qw(NFC); use Enco...
Here is a script to fix broken Cyrillic filenames if the files were moved to Mac from Windows (based on an answer to https://unix.stackexchange.com/q/792464)
#!/bin/zsh

# Usage:  
# Requires Perl::Rename

find "$1" -mindepth 1 -print0 |
  rename -0 -d -e '
    use Unicode::Normalize qw(NFC);
    use Encode qw(:all);

    if ($_ =~ /[†°Ґ£§•¶І®©™Ђђ≠]/) {
      my $check = DIE_ON_ERR | LEAVE_SRC;
      my $new = eval {encode("UTF-8",
                      decode("cp866",
                      encode("mac-cyrillic",
                      NFC(decode("UTF-8", $_, $check)), $check), $check))
                     };
      if ($new) {$_ = $new;} else {warn $@;}
    }'
I want it to rename only those files in the target direcotry that have at least one of the following characters in their filenames: †°Ґ£§•¶І®©™Ђђ≠. But for some reason the script renames all of the files there instead: for example, a correct filename срочно.txt is changed to a meaningless ёЁюўэю.txt. What I'm doing wrong? The path to my test folder is simply /Users/john/scripts/test: no spaces and no Cyrillic or special characters. The script is used on macOS and with BSD-version of find. An update two days after the question was answered: Stéphane's Chazelas and Choroba's versions work fine for me. Terdon's version doesn't work for me yet.
jsx97 (1347 rep)
Apr 14, 2025, 08:03 PM • Last activity: Apr 17, 2025, 03:54 AM
0 votes
1 answers
791 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 `apt` commands work. I can't install anything. * Here the result of the `perl -v` command: ```none perl: /usr/lib/x86_64-linux-gnu/libcrypt.so.1: version `XCR...
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 apt commands work. I can't install anything. * Here the result of the perl -v command:
perl: 
    
        /usr/lib/x86_64-linux-gnu/libcrypt.so.1: version `XCRYPT_2.0' not found (required by perl)
* and
-shellsession
    $ ls -l /usr/lib/x86_64-linux-gnu/libcrypt.so.1:

    /usr/lib/x86_64-linux-gnu/libcrypt.so.1 -> /usr/lib/x86_64-linux-gnu/libcrypt-2.28.so
* The apt --fix-broken install command also does not work **Edit:** This is my /etc/apt/sources.list file:
deb http://deb.debian.org/debian/  bookworm main
deb http://security.debian.org/debian-security  bookworm-security main
deb http://deb.debian.org/debian/  bookworm-updates main
Is this correctly configured?
Szymon Tesmer (1 rep)
Jul 10, 2024, 10:52 AM • Last activity: Apr 9, 2025, 03:02 PM
1 votes
0 answers
444 views
Can't execute perl script
I am not able to execute the Perl script in the Docker container: [root@11efb25fa64f perl]# ./launch-commands.pl ./launch-commands.pl bash: ./launch-commands.pl: Operation not supported It is not a case of privileges: -rwxr-xr-x 1 31647 38727 1014 Jan 14 23:11 launch-commands.pl I am using Fedora-36...
I am not able to execute the Perl script in the Docker container: [root@11efb25fa64f perl]# ./launch-commands.pl ./launch-commands.pl bash: ./launch-commands.pl: Operation not supported It is not a case of privileges: -rwxr-xr-x 1 31647 38727 1014 Jan 14 23:11 launch-commands.pl I am using Fedora-36 as base image for my container (also I tried out the Fedora 34) head launch-commands.pl #!/usr/bin/perl When I installed perl package with: dnf install perl Message is different but still, I am not able to execute the perl script: [root@11efb25fa64f perl]# perl ./launch-commands.pl Can't open perl script "./launch-commands.pl": Operation not supported' Container was created in this way: docker container run -it --name perl fedora:36 Image was taken from Docker Hub: https://hub.docker.com/_/fedora Image details: docker image ls fedora 36 0e68c6a5f825 5 weeks ago 165MB Container details: docker container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAME 11efb25fa64f fedora:36 "/bin/bash" 27 minutes ago Exited (126) About a minute ago perl Does anyone have an idea why I am not able to execute perl script in Docker container with Fedora 34/36? **UPDATE:** mount | grep docker fuse-overlayfs on /var/lib/docker/fuse-overlayfs/4ddab38226cf27392d25efd57233577f744299fccd019a934b5af547a4acaf98/merged type fuse.fuse-overlayfs (rw,nodev,noatime,user_id=0,group_id=0,default_permissions,allow_other) nsfs on /run/docker/netns/97ad8526d392 type nsfs (rw) fuse-overlayfs on /var/lib/docker/fuse-overlayfs/9a513cb4e3d7e2231760cb8b08ed9d514a7712edbea7171fef30f375a9f6077e/merged type fuse.fuse-overlayfs (rw,nodev,noatime,user_id=0,group_id=0,default_permissions,allow_other) nsfs on /run/docker/netns/d5b7cde0e066 type nsfs (rw) Storage driver: [root@dot docker]# docker info | grep Storage Storage Driver: fuse-overlayfs
sqr (17 rep)
Jan 18, 2023, 06:12 PM • Last activity: Mar 20, 2025, 09:39 AM
3 votes
3 answers
1381 views
Conditional replacement using perl
Very simple hypothetical question, I've reached the limitation of `sed` and need to change my `sed` script to `perl`. So for `sed` conditional replacement of sed '/condition/ s/xx/yy/' How to do it in perl? For e.g. how to do the following in perl? ``` seq 6 > /tmp/tf $ paste -d '' /tmp/tf /tmp/tf |...
Very simple hypothetical question, I've reached the limitation of sed and need to change my sed script to perl. So for sed conditional replacement of sed '/condition/ s/xx/yy/' How to do it in perl? For e.g. how to do the following in perl?
seq 6 > /tmp/tf

$ paste -d '' /tmp/tf /tmp/tf | sed -E '//s/^(.)(.)$/\1.\2-/'
1.1-
22
3.3-
44
5.5-
66

$ paste -d '' /tmp/tf /tmp/tf | perl -pe 's/$&/$1.$2-/ if /^()(.)$/'
.-
22
.-
44
.-
66
xpt (1858 rep)
Jun 11, 2022, 04:02 PM • Last activity: Mar 19, 2025, 07:18 PM
0 votes
1 answers
124 views
Perl: The module is installed but doesn't work
I remember I have installed Perl::Rename, by using `cpan -i File::Rename`, and indeed I have `$HOME/perl5/bin` with `rename` and `unsafe-rename` executables there. But when I try to use `rename`, ```sh # Expected: Renames FooBar.txt to Foo_Bar.txt # It worked for me in the past rename 's/\s/_/' *.tx...
I remember I have installed Perl::Rename, by using cpan -i File::Rename, and indeed I have $HOME/perl5/bin with rename and unsafe-rename executables there. But when I try to use rename,
# Expected: Renames FooBar.txt to Foo_Bar.txt
# It worked for me in the past
rename 's/\s/_/' *.txt
...there is an error:
Can't locate File/Rename.pm in @INC (you may need to install the File::Rename module) (@INC contains: /Library/Perl/5.34/darwin-thread-multi-2level /Library/Perl/5.34 /Network/Library/Perl/5.34/darwin-thread-multi-2level /Network/Library/Perl/5.34 /Library/Perl/Updates/5.34.1 /System/Library/Perl/5.34/darwin-thread-multi-2level /System/Library/Perl/5.34 /System/Library/Perl/Extras/5.34/darwin-thread-multi-2level /System/Library/Perl/Extras/5.34) at ./rename line 4.
BEGIN failed--compilation aborted at ./rename line 4.
Then I tried to reinstall File::Rename, by using the same command, but then there is another error message, a very long one. Here is a part from the very end:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/Library/Perl/5.34/File'
mkdir /Library/Perl/5.34/File: Permission denied at /System/Library/Perl/5.34/ExtUtils/Install.pm line 470.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 at -e line 1.
make: *** [pure_site_install] Error 13
  RMBARKER/File-Rename-2.02.tar.gz
  /usr/bin/make install  -- NOT OK
What is goind on here?.. Perl itself is the one that is supplied with macOS. I didn't istall it.
jsx97 (1347 rep)
Mar 16, 2025, 12:53 AM • Last activity: Mar 16, 2025, 11:38 AM
1 votes
1 answers
47 views
Git hook on SSH remote fails due to not reading shell configuration
I'm using a git post-receive hook to perform some actions after a git push to a remote server. This remote operates over SSH: ``` $ git remote -v server user@server:repo.git ``` The problem is that this hook is written in Perl, and using a Perl version different from the system Perl (managed with Pe...
I'm using a git post-receive hook to perform some actions after a git push to a remote server. This remote operates over SSH:
$ git remote -v
server  user@server:repo.git
The problem is that this hook is written in Perl, and using a Perl version different from the system Perl (managed with Perlbrew). When the script executes, after the push (which runs perfectly) it fails due to the script using a different version — that is, the script supposed to run with the modern Perlbrew Perl gets executed with the system Perl. It is also important to note that the script starts with:
#!/usr/bin/env perl
I assume this happens because the SSH through git does not read my _.zprofile_ file, which is where all of the Perlbrew setup happens. Why is that? If it is over SSH, shouldn't it open a shell from my user and consequently read the profile? Is there a way to make this work with my custom Perl?
sidyll (217 rep)
Mar 12, 2025, 01:11 PM • Last activity: Mar 13, 2025, 12:11 PM
979 votes
11 answers
1831668 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 directories? * replace only if the file name matches another string? * replace only if the string is...
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 directories? * replace only if the file name matches another string? * replace only if the string is found in a certain context? * replace if the string is on a certain line number? * replace multiple strings with the same replacement * replace multiple strings with different replacements
terdon (251585 rep)
Feb 1, 2014, 05:05 PM • Last activity: Mar 13, 2025, 01:30 AM
6 votes
2 answers
523 views
How to make Perl half/full width-insensitive regular expressions?
In Perl, `/a/i` matches both A and a, so I don't have to write `/A|a/`. What is the easy way to write `/4|4/` ? Yes, I'm talking about ``` lang-sh $ unicode 4 4|grep U+ U+FF14 FULLWIDTH DIGIT FOUR U+0034 DIGIT FOUR ``` Must I repeat each line, ``` if (/大茅埔段32(7|8|9).地/ || /大茅埔段32(7|8|9).地/) {...} ``...
In Perl, /a/i matches both A and a, so I don't have to write /A|a/. What is the easy way to write /4|4/ ? Yes, I'm talking about
lang-sh
$ unicode 4 4|grep U+
U+FF14 FULLWIDTH DIGIT FOUR
U+0034 DIGIT FOUR
Must I repeat each line,
if (/大茅埔段32(7|8|9).地/ ||
        /大茅埔段32(7|8|9).地/)     {...}
or is there a better way? It's not that many characters, https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) By the way, how to make
$ echo A|perl -pwle 's/a/x/i'
match? (Both A's are wide.)
Dan Jacobson (560 rep)
Feb 26, 2025, 02:16 AM • Last activity: Mar 1, 2025, 01:46 PM
4 votes
3 answers
7413 views
How to print top five highest numbers from a column?
I have a text file with four columns. I need to read till end of file and print the highest number from column3 (top 5 values) along with column 1. **input.txt** xm|340034177|ref|RT_235820.1| 139697 192 0 xm|161622288|ref|RT_340093.1| 153819 2607 0 xm|75755638|ref|RT_557407.1| 153821 1937 0 xm|10877...
I have a text file with four columns. I need to read till end of file and print the highest number from column3 (top 5 values) along with column 1. **input.txt** xm|340034177|ref|RT_235820.1| 139697 192 0 xm|161622288|ref|RT_340093.1| 153819 2607 0 xm|75755638|ref|RT_557407.1| 153821 1937 0 xm|108773031|ref|RT_678101.1| 161452 1688 0 xm|30352011|ref|RT_784766.1| 150568 105 0 **output.txt** xm|161622288|ref|RT_340093.1| 2607 xm|75755638|ref|RT_557407.1| 1937 xm|108773031|ref|RT_678101.1| 1688 xm|340034177|ref|RT_235820.1| 192 xm|30352011|ref|RT_784766.1| 105
jack (3933 rep)
Jun 12, 2014, 01:55 AM • Last activity: Mar 1, 2025, 09:26 AM
2 votes
1 answers
361 views
Attempt to call undefined import method with arguments ("abs2rel") via package "File::Spec"
I have `Debian GNU/Linux trixie/sid` and I installed [publican][1] from repo of debian. (publican is doing write and publish for `DocBook`) When I run `publican` , It get the following messages: Attempt to call undefined import method with arguments ("abs2rel") via package "File::Spec" (Perhaps you...
I have Debian GNU/Linux trixie/sid and I installed publican from repo of debian. (publican is doing write and publish for DocBook)
When I run publican , It get the following messages: Attempt to call undefined import method with arguments ("abs2rel") via package "File::Spec" (Perhaps you forgot to load the package?) at /usr/share/perl5/Publican/TreeView.pm line 12. Duplicate specification "help" for option "help" Can't open publican: No such file or directory at /usr/bin/publican line 646. Version of my publican is 4.3.2-4.
Also I installed libfile-spec-native-perl package from repo. Then I download source code via: apt source publican Then run publican and get the following error: mohsen@debian:~/src-compiled/publican/publican-4.3.2/bin$ ./publican Attempt to call undefined import method with arguments ("abs2rel") via package "File::Spec" (Perhaps you forgot to load the package?) at /usr/share/perl5/Publican/TreeView.pm line 12. Duplicate specification "help" for option "help" Action required! According to above Action Required! string added to output. I don't know how do I solve it.
You make me happy if solved my problem.
PersianGulf (11308 rep)
Feb 2, 2025, 12:46 PM • Last activity: Feb 3, 2025, 12:49 AM
0 votes
1 answers
72 views
Error when installing ImageMagick with perlbrew
I am trying to install ImageMagick for `perlbrew` as an application needed a higher version of Perl than the one that came with my Ubuntu, and this application also needs to use ImageMagick. I am on ubuntu jammy and I am using _Perl 5.36.3_ with `perlbrew`. When I try to install ImageMagick with `pe...
I am trying to install ImageMagick for perlbrew as an application needed a higher version of Perl than the one that came with my Ubuntu, and this application also needs to use ImageMagick. I am on ubuntu jammy and I am using _Perl 5.36.3_ with perlbrew. When I try to install ImageMagick with perlbrew, I get this error:
cpan> install Image::Magick
Reading '/home/me/.cpan/Metadata'
  Database was generated on Thu, 09 Jan 2025 03:17:02 GMT
Running install for module 'Image::Magick'
Checksum for /home/me/.cpan/sources/authors/id/J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz ok
Scanning cache /home/me/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning (mostly harmless): No library found for -lMagickCore-7.Q16HDRI
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
  JCRISTY/Image-Magick-7.1.1-28.tar.gz
  /home/me/perl5/perlbrew/perls/perl-5.36.3/bin/perl Makefile.PL -- OK
Running make for J/JC/JCRISTY/Image-Magick-7.1.1-28.tar.gz
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Magick ()
chmod 644 "Magick.bs"
"/home/me/perl5/perlbrew/perls/perl-5.36.3/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Magick.bs blib/arch/auto/Image/Magick/Magick.bs 644
"/home/me/perl5/perlbrew/perls/perl-5.36.3/bin/perl" "/home/me/perl5/perlbrew/perls/perl-5.36.3/lib/5.36.3/ExtUtils/xsubpp"  -typemap '/home/me/perl5/perlbrew/perls/perl-5.36.3/lib/5.36.3/ExtUtils/typemap' -typemap '/home/me/.cpan/build/Image-Magick-7.1.1-3/typemap'  Magick.xs > Magick.xsc
mv Magick.xsc Magick.c
cc -c  -I/usr/local/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/libxml2 -I"/usr/include/ImageMagick-7" -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/freetype2 -g -O2 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -O2   -DVERSION=\"7.1.1\" -DXS_VERSION=\"7.1.1\" -fPIC "-I/home/me/perl5/perlbrew/perls/perl-5.36.3/lib/5.36.3/x86_64-linux/CORE"  -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:56:10: fatal error: MagickCore/MagickCore.h: No such file or directory
   56 | #include 
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:351: Magick.o] Error 1
  JCRISTY/Image-Magick-7.1.1-28.tar.gz
  /usr/bin/make -- NOT OK
Failed during this command:
 JCRISTY/Image-Magick-7.1.1-28.tar.gz         : make NO
stacking and exchanging woohoo (63 rep)
Jan 9, 2025, 06:54 AM • Last activity: Jan 22, 2025, 01:13 PM
1 votes
1 answers
26 views
What is the "reports" command in install errors
While trying to install the [`Chart::Clicker`](https://metacpan.org/pod/Chart::Clicker) perl module, I get a lot of dependency errors. When trying to resolve them, I get similar output for each module from the first to the last module listed in the dependencies list. Example For `Module::Pluggable`:...
While trying to install the [Chart::Clicker](https://metacpan.org/pod/Chart::Clicker) perl module, I get a lot of dependency errors. When trying to resolve them, I get similar output for each module from the first to the last module listed in the dependencies list. Example For Module::Pluggable:
Failed 1/45 test programs. 2/192 subtests failed.
make: *** [Makefile:914: test_dynamic] Error 2
  SIMONW/Module-Pluggable-6.2.tar.gz
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports SIMONW/Module-Pluggable-6.2.tar.gz
What/where is reports? This is running on xubuntu 24.04LTS
Gene (11 rep)
Jan 6, 2025, 06:42 PM • Last activity: Jan 6, 2025, 07:55 PM
Showing page 1 of 20 total questions