Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
51 views

Convert string range into array of numbers in perl and prefix with another string [duplicate]

I have a string list (i.e: 1-15) and I want to generate this Scenario_01 ... Scenario_10 Scenario_11 ... Scenario_15 I tried this range=1-15 echo $range | perl -pe 's/(\d+)-(\d+)/join(" ...
jayar's user avatar
  • 1
0 votes
1 answer
60 views

Warning "Substitution replacement not terminated", only in sourced shell script

I'm trying to remove all directories whose path matches a certain pattern from the path, within a script that would be sourced using .. The script prints a warning "Substitution replacement not ...
david's user avatar
  • 1,016
1 vote
2 answers
145 views

How do I find the oldest used files from a program that links its bins, like Homebrew? [closed]

How do I find the oldest used files from this? MBP:~ user$ \ls -la /usr/local/bin/ | egrep -i "Cellar|Cask" | head lrwxr-xr-x 1 user admin 37 Sep 13 12:19 2to3 -> ../Cellar/...
Polo's user avatar
  • 129
1 vote
4 answers
254 views

Perl one-liner: capture groups in a substitution being interpreted as octal

Assume that I have a file that contains the text foo_bar_baz, and I want to replace it with foo_bar_1234 (this is a simplified version of a more complex issue). First try: $ echo "foo_bar_baz&...
QF0's user avatar
  • 469
5 votes
5 answers
183 views

Reverse string in specific fields with condition

I have this file: m64071_220512_054244/12584899/ccs rev pet047-10055 ACGTGCGACCTTGTGA TTGAGGGTTCAAACGTGCGACCTTGTGA m64071_220512_054244/128321000/ccs rev pet047-10055 ACGTGCGACCTTGTGA ...
pedro's user avatar
  • 443
3 votes
9 answers
263 views

more efficient HH:MM:SS conversion possible?

I'm wondering please if there is a more efficient way to convert HH:MM:SS to decimal hours for the ordinate (y) axis of gnuplot, with dates on the (x) abscissa. Some of these plots have many thousands ...
dwarnok's user avatar
  • 31
7 votes
5 answers
236 views

Trying to extract a substring and version number from a filename using bash

I'm currently trying to extract a substring and version number from a filename using bash. There are two formats the filenames will be in: example-substring-1.1.0.tgz example-substring-1.1.0-branch-...
cybersnow1989's user avatar
-1 votes
3 answers
167 views

How to convert the perl index script to bash function

I want to use perl to get the index of from any given string and substring in bash function. Here is the example for getting the indexOf value from perl script: https://www.geeksforgeeks.org/perl-...
stackbiz's user avatar
  • 1,342
1 vote
4 answers
88 views

Bash script to replace content of line with information in a consequent line (sed)

I have a File.txt listing several items and additional details in consequent lines included in square brackets []: item name1, item name2, item name3, item name4, some text on several lines detail ...
Enialis's user avatar
  • 37
5 votes
7 answers
305 views

Randomize txt file in Linux but guarantee no repetition of lines

I have a file called test.txt which looks like this: Line 1 Line 2 Line 3 Line 3 Line 3 Line 4 Line 8 I need some code which will randomize these lines BUT GUARANTEE that the same text cannot appear ...
DarrenB's user avatar
  • 115
0 votes
0 answers
835 views

why does the situation "client_loop: send disconnect: Broken pipe" occur during SSH connection in one case and does not occur in another

If I do like this (bash): SSH_COMMAND="ssh -t ${LOGIN}@${HOST}" sshpass -p ${PASSWD} ${SSH_COMMAND} "command" then I get the result: client_loop: send disconnect: Broken pipe and (...
mr.Q's user avatar
  • 9
1 vote
1 answer
45 views

Running system command fails but the same command works executed directly in bash

I am running the following code in perl my $exp_date = `date --date="$(openssl x509 -enddate -noout -in certificate.pem | cut -d= -f 2)" --iso-8601`; and I get: date: invalid date ‘100 ...
Jim's user avatar
  • 4,235
-1 votes
1 answer
117 views

How do I get a SECONDS variable in Perl from bash?

How do I display basic variables like SECONDS inside Perl while running command in bash? perl -e 'system(bash -c echo $SECONDS)' It displays nothing at all. I have no access to the bash variables, ...
CuriousPanda's user avatar
2 votes
2 answers
172 views

Is it possible to call bash function from Perl? [duplicate]

admin@admin:~$ function fun1() { echo "abc"; } admin@admin:~$ fun1 abc I want to call this function from Perl. admin@admin:~$ perl -e 'fun1' admin@admin:~$ There is no output. What do I ...
CuriousPanda's user avatar
-1 votes
1 answer
273 views

How to replace PS1 variable in /etc/skel/.bashrc or .bashrc file using sed, awk, or perl?

Edit - 06/08/23 - Original Question Kept Substantially the Same Thanks to Charles Duffy for providing valuable feedback in comments. The original question occurs in the context of item 1. But based on ...
SystemTheory's user avatar

15 30 50 per page
1
2 3 4 5
134