1,924 questions
4 votes
2 answers
136 views
Why doesn't this look-behind assertion with a predefined regular expression work as expected?
Why do the third and fourth substitutions produce different results? #!/usr/bin/env raku use v6.d; my $str; my regex myregex1 { <[\d;]>+ }; $str = "abc3def0ghi"; $str.=subst( / <?...
5 votes
1 answer
110 views
eval(substitute()) within a R6 object
I need to evaluate an expression within an R6 object. Let's say: A <- R6::R6Class('A', public=list( f1 = 1 )) test <- A$new() eval(...
Advice
0 votes
9 replies
97 views
Shell substitute/show variables from one variable
The task is to show line with variables from one variable (substitute like echo "${!VAR_NAME}" but for multible variables at once) i e g l=$(head -1 "$table") #this header can vary ...
1 vote
2 answers
106 views
Index array without assigning it to parameter
I have to split a string and use a part of it for further processing. So the idea is: string='aaa-bbb-ccc-ddd' parts=(${(@s:-:)string}) print -- $parts[3] # ccc I would like to refactor the second ...
1 vote
1 answer
104 views
Bash variable string substitution to '*'
I tried to figure out how to replace a string variable to '*' a="bamtools/*/*bam_metric.summary.tsv" ## not working echo ${a/*\*/} I would like to see bam_metric.summary.tsv after ...
1 vote
1 answer
84 views
Cleanest way to perform substitution into solution output by Sympy linsolve
Consider the following output by the linsolve function of sympy. solution_vector = (-2.0*x2 - 2.0, 4.0*x4 + 4.0*x7 + 2.0, x2, -2.0*x4 - 1.0*x5 - 2.0*x7 - 2.0, x4, x5, x6, x7, x8) As we can see, in ...
5 votes
2 answers
145 views
How do you specify a variable name for a function call using a character variable in R?
I am working in R trying to create a wrapper function that calls a specified internal function (which is some existing function) and does some things with it. My wrapper function will include an ...
0 votes
2 answers
72 views
How to create new dataframe that copies all data from another where the new one converted all values beginning with -9 to NaN?
I have a dataframe of 10899 rows × 32 columns where there are many cells containing data that start with -9. e.g. -99.0, -9, -9.678, etc. How can I create a new dataframe from the original where all ...
0 votes
1 answer
77 views
how can I force a substitution in vim editor?
I've used vi/vim since like 1995, and this operation always worked :1,$s/x/y/g But on this new box, running vim 7.4.629, when I run that command, it DOES do the operation, all x and now y, and ...
1 vote
0 answers
365 views
VSCode SQL Developer Substitution Variable
When I'm using & as a substitution variable SQL Developer in VSCode is saving my input instead of deleting it. For example, if I have '&ename' and enter Steven in the pop up, the next time I ...
0 votes
2 answers
92 views
replace strings in an xml document using a 1:1 replacement file
For a Linux OS to be distributed I have an Openbox menu.xml file that contains about 30 words that would need to be translated for that menu to be localized. I assembled a .csv document with two ...
-2 votes
2 answers
81 views
Bash string substitution - bug?
I am trying to do some file management in bash and I have strings in this format: 1 dir/hello.txt 2 dir2/bar.jpg When I run this substitution: ${FOO/[:space:]*/Hello} I get this result: 1 dir/hHello ...
1 vote
0 answers
86 views
How can I remove a prefixing or suffixing date,or datetime, from a string in powershell [duplicate]
As part of a bigger powershell task, I need to remove a date (or datetime) prefix or suffix from a string (Actually a filename) The filename is returned from a file watcher, where the filter is *.txt. ...
0 votes
1 answer
82 views
GCP CloudBuild substitution fails in pipeline
According to the GCP CloudBuild documentation one can use shell parameter expansion in pipeline substitutions. I want to define a tag name for docker images based on the names of our git branches. ...
2 votes
1 answer
88 views
How does `substitute` choose the deparsed representation of objects?
base::substitute's documentation describes it as follows: Substitution takes place by examining each component of the parse tree as follows: If it is not a bound symbol in ‘env’, it is unchanged. If ...