Convert string range into array of numbers in perl and prefix with another string [duplicate]
This question already has answers here: Perl sequence of numbers with leading zeros (2 answers) Closed 2 days ago. 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(” Scenario_0″,$1..$2)/eg’ and getting this 1 Scenario_02 Scenario_03 […]
Using bash/perl/ruby or whatever, obtain frequent phrases of three words (or n words) in a file
I have a text file with hundred of lines.
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 following one-line perl invocation seems idiomatic, but it prints a warning “Substitution replacement not terminated at -e line 1.
” when the script is sourced: