1,922 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Advice
0
votes
9
replies
92
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
92
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
97
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
78
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
136
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
67
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
71
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
329
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
88
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
79
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
77
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
77
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
83
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 ...
2
votes
2
answers
135
views
Why isn't inline variable substitution working?
Below is the Perl script:
my $var="
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
-2
votes
1
answer
103
views
Bash parameter substitution fails on spaces and newlines [closed]
When I try to separate a string into its characters, it fails on spaces and newlines:
str=" random string
"
echo ${str//?/ \'&}
' 'r 'a 'n 'd 'o 'm ' 's 't 'r 'i 'n 'g '
The parameter ...