Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
92 views

Bash: Reading in a string from a file with variable substitution

I have a weird situation where I have a command stored in a file and that file contains references to variables. I'm able to read the file just fine, but I'm having trouble getting variable expansion ...
SailorCire's user avatar
1 vote
1 answer
624 views

File-transform-task in Azure DevOps release-pipeline not substituting variables

In my project, there is a Webservice.settings containing 3 variables. (Structure of Webservice.settings) I intent to set these variables with my release-pipeline (Azure DevOps). Therefore, I created a ...
Nepomuk's user avatar
  • 21
0 votes
1 answer
18 views

Makefile: Substituting suffix of variable before evaluation

QUESTION: I would like to write a Makefile with a loop, which prints the contents of variables whose names contain the loop counter. EXAMPLE: For example, I would like something like the Makefile ...
Sophia Goulimis's user avatar
0 votes
0 answers
114 views

Variable substitution: How to update values in a json file and then save the output of the now substituted file

I have a script that I want to do variable substitution on a json file. It takes json file A and json file B and converts it into a dynamic object. So you end up with something like this: For Json ...
polo's user avatar
  • 365
0 votes
2 answers
188 views

Can a Gnu Make variable substitution expression match more than one pattern?

Say I have a list of files with mixed suffixes, e.g. .cpp and .c, and I want to make a list where each .cpp and each .c extension is changed to .o. I realize I could sequentially process my list ...
Michael57's user avatar
1 vote
2 answers
324 views

Environment variables substitution in C

I have a string with the following content (UTF-8): __$FOO ${FOO} ${FOO:def} ${FOO2:-тест} And environment variable FOO with a value test. My C application should work like a GNU envsubs - replace ...
Paramtamtаm's user avatar
-4 votes
1 answer
42 views

Excel Summing Un-Formatted Numbers [closed]

I'm trying to find an average of a large array of candidates compensation. Some of the cells contain text with multiple numbers showing a range such as, "$100k - $120k". Others are labeled ...
Iceyz's user avatar
  • 3
2 votes
1 answer
111 views

Call a .NET method with part of the method name replaced by a variable

Here is a simple command that I would like to use a variable in. (Get-Date).AddDays(-30) What I'm trying to do is substitute a variable $Time for the word Days. $Time="Days" OR $Time="...
user2893271's user avatar
0 votes
1 answer
435 views

How to add variables in a call to Start-Process

I'm building a PowerShell script to run the following command on various servers: arapx acc, Export ExportFile=\"C:\\Temp\\DEV_Refresh\\AccExport.txt\" This code works: Start-Process -...
Ken's user avatar
  • 309
1 vote
2 answers
529 views

Azure DevOps Pipeline Json Variable Substitution - Ocelot.json

I have the following file ocelot.json and I want to change the Host object of each route configured inside the file through a variable. I want to change the localhost to the correct hostname through a ...
camilo-cajamarca's user avatar
0 votes
1 answer
1k views

Passing variables from bash script into Oracle SQL*Plus

I've tried a few different methods (from here and elsewhere) with no success and was hoping if one of the more experienced individuals of yourselves would be able to help. This is my shell script read ...
LJMurru's user avatar
0 votes
2 answers
35 views

Embedded parameter substitution

This is what parameter substitution would be one by one (transforming a picture file name into a date) : var=“2020-12-30 11-30-55CX.mov” p1=${var:0:11} pt=${var:11:8} p2=${pt//-/:} dt=“${p1} ${p2}” I ...
Guasqueño's user avatar
0 votes
1 answer
4k views

Getting a count of rows inserted in a Snowflake procedure

I'm using a procedure to insert rows into a table. I want to return the count of rows inserted, but I can't figure out how to turn on the variable substitution from inside a procedure. I've tried all ...
ASturt's user avatar
  • 363
0 votes
1 answer
154 views

Substituting variable in a dataframe row based on other row's value

I have a dataframe that contains ID, Formula, and a dependent ID column that I extracted the ID from the Formula column. Now I have to substitute all the dependent ID into the formulas based on the ...
user10969675's user avatar
1 vote
2 answers
258 views

Is there a parameter substitution syntax for file or directory existence?

I would like to use parameter substitution to compute a path based on a variable being defined a first default directory to be used if it exists a file inside the $HOME directory to be used if ...
iconoclast's user avatar
  • 22.3k
1 vote
1 answer
186 views

Variable Substiution in sed executing via python

Below is my sed command: sed "s/N([0-9]*)/sum('\1')/g" old.txt > new.txt works fine in bash terminal But below python code doesnot execute :- file1=old.txt file2.new.txt sed_cmd = 'sed &...
HDev007's user avatar
  • 325
-1 votes
2 answers
78 views

Linux bash; manipulate PATH type var

Linux debian bash. I have a PATH type variable 'X' that I want to manipulate. 'X' can be any number of elements delimited by ":" For example, using fruits: set X=apple:pear:orange:cherry ...
user avatar
-2 votes
2 answers
942 views

How to expand array in Bash adding double quotes to elements?

I would like to pass an array to a function and use the values in the array as a command parameter, something like this: command can receive N parameters, example: param1 param2 oneparam 1 a 2 b 3 c ...
user5507535's user avatar
  • 1,750
0 votes
2 answers
773 views

Dotnet framework - Nlog configuration change using variable substitution in TFS cd pipeline

I have Nlog configuration in the web config file and I would like to change the file path in the CD pipeline in order to put some dynamic path based on the environment. Right now the web.config file ...
Abi P's user avatar
  • 1,450
-1 votes
1 answer
2k views

##[error]Error: NO JSON file matched with specific pattern: **/appsettings.json

I'm trying to deploy an Azure App Service using Azure Devops. I'm using the Task Azure App Service deploy version 4.* I started noticing the following error in the log recently with the deployment ...
Alen Alex's user avatar
  • 949
0 votes
1 answer
2k views

Azure DevOps Pipeline Json Variable Substitution - Microsoft.Hosting.Lifetime

How can I change the value of Logging:LogLevel:Microsoft.Hosting.Lifetime using a Json Variable Substitution task in Azure DevOps? This article... https://learn.microsoft.com/en-us/azure/devops/...
Beakie's user avatar
  • 1,999
0 votes
1 answer
298 views

Capture and replace a string found between two strings

I am trying to replace the values for a specific variable named variable but only if this is contained between two strings, namely between group1 and group2. (or group1 till the end of text if group2 ...
Florian Bidabé's user avatar
0 votes
1 answer
2k views

Xml Transformation and Variable substitution doesn't work when both selected in Azure DevOps

I have been working on the build and release pipelines for a while now, but ran into this issue lately I am performing config transform on .net application. The issue i am running into is a bit ...
AnsibleUser's user avatar
1 vote
1 answer
176 views

Simple configuration files template processor that preserves bash-style variables

I have to introduce some templating over text configuration files (yaml, xml, json) that already contain bash-like syntax variables. I need to preserve existing bash-like variables untouched but ...
Roman Nikitchenko's user avatar
1 vote
0 answers
188 views

Transformation / Substitution of configuration files in AWS CodePipeline

Finally getting into AWS after several years in Azure. I have a CodePipeline set-up for a dotnet core lambda function. Traditionally I have set-up build pipelines and then transformed the ...
JDBennett's user avatar
  • 1,443
0 votes
0 answers
991 views

KeyVault --> Azure Pipeline --> XML variable substitution adds extra single quote to the end which breaks the connection string

I asked previously how to do variable substitution with Azure KeyVault here, and was able to get it mostly working save one last issue. For some unknown reason, the substitution occurs perfectly but ...
Hershizer33's user avatar
  • 1,246
7 votes
2 answers
13k views

Azure Devops Release Pipeline XML Variable Substitution not working

I have a very simple variable substitution in my release pipeline, but it's not working. I have the variable in the connectionStrings.config file as such: <?xml version="1.0"?> <...
M.R.'s user avatar
  • 4,797
2 votes
2 answers
698 views

Substitution Encryption/Decryption in R

Using the variables alpha and key, encrypt ptext into a variable named ctext. Using substitution cipher So I have a text file separated in a vector ptext <- strsplit(ptext,split = "", fixed = ...
Zaid Islam's user avatar
4 votes
1 answer
3k views

Docker-compose variable-substitution mandatory variables

I have a docker-compose file that uses variable substitution for some secrets and I want to get an error if they are not supplied or empty, for this purpose I have tried this: environment: - >- ...
Redline's user avatar
  • 531
0 votes
2 answers
345 views

Variable substitution within a string

I'm trying to come up with some very reusable code that will look up and perform variable substitutions within a string. The example string below contains a $$ reference to a variable. Format is ...
Dan's user avatar
  • 2,334
1 vote
2 answers
584 views

Substitute variable as an input from the STDOUT of a console application

In our release pipeline, we have a console app that performs a function which generates an encryption key and outputs it to STDOUT. We need to be able to use this value in a variable during deployment ...
Dean Selley's user avatar
-1 votes
1 answer
288 views

How to substitute values in a key-value file if keys exists in shell environment?

I have a file like below with key value pair separated by =. I have already exported some variables to my shell. Now I want a shell script which can substitute the values for its corresponding keys if ...
SkyRar's user avatar
  • 1,227
1 vote
1 answer
2k views

Separating yaml files and passing in variables

Is there any way to separate a YAML file and pass in variables to sub files? For Example: Parent yaml file: Fn::Merge: - !Include /templates/first.yaml, variables: {env: staging} - !Include /...
John David's user avatar
1 vote
0 answers
27 views

String distances and variable substitution costs

I want to quantify distance between word pairs based on phonological features. Insertion and deletion costs will stay constant but substitution costs will vary according to letter pair which are ...
Rkindellan's user avatar
3 votes
3 answers
881 views

How to find the nth multiline block of text using sed

So I have a file which contains blocks that looks as follows: menuentry ... { .... .... } .... menuentry ... { .... .... } I need to look at the contents of each menu entry in a bash script. I ...
WarBro's user avatar
  • 305
0 votes
0 answers
37 views

Variable Subsitution When Using Django?

Currently, I use the following code to include another HTML file: {% include "machines/opennebula/resources.html" %} I am adding another folder to add another version of resources.html (...
MRichards's user avatar
1 vote
1 answer
2k views

Bash: Insert variable content into command substitution as arguments - how to quote correctly?

I really really don't find a solution to this problem: Say I have a variable that has multiple lines, each line should be one argument in the end. line 1 line two ... I only get this data at ...
flix's user avatar
  • 105
1 vote
1 answer
260 views

How to nest bash command output into an array inline?

Note - this is not a duplicate! There are other questions covering converting bash output to a bash array - but none of them do it inline. The reason you need inline is because of until. I'm trying ...
hawkeye's user avatar
  • 35.5k
4 votes
1 answer
3k views

Strategy for Octopus variable substitution in config.js that is webpacked in jenkins

I am working on an ES6 AngularJS project where I am using webpack to bundle everything into dist/app.js. The CI/CD stack I am working with is SCM - Jenkins - Octopus: Updates to my code are pushed ...
valorl's user avatar
  • 1,559
3 votes
2 answers
7k views

Variable substitution in a list in Tcl

I am trying to substitute a variable in a list: % set a 1 1 % set b {1 $a} 1 $a % % set a 1 1 % set b [list 1 $a] 1 1 When I use the curly braces {}, to define the list the ...
skorada's user avatar
  • 461
0 votes
1 answer
122 views

Javascript variable substitution

I have an array daysoftheweek:['Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday','Saturday', 'Sunday'], Also I have functions function totalMonday() {} function totalTuesday() {} Can I use ...
LeBlaireau's user avatar
  • 17.4k
2 votes
2 answers
46 views

Is there an equivalent to <(process list) for variables?

I can use <(some command) in place of a file, but how can I achieve the equivalent with a variable? I'm using the paste command, which expects files as arguments, and want to use the contents of ...
Matt Joiner's user avatar
2 votes
1 answer
41 views

Bash Variables - Define Multiple Possible Expected Values

Apologies if this has been answered previously, but I couldn't find much online. Here's what I'm trying to accomplish: if [[ "${hostname}" = (foo | bar)servername(01 | 02 | 03) ]]; then var="...
Tronyx's user avatar
  • 29
12 votes
1 answer
7k views

When do you need curly braces for variable substitution in Gradle?

If you have variables defined in your gradle.properties file, when is it necessary to use curly braces for variable substitution (e.g., "some string ${yourVariable}") and when is it okay to do without ...
Michael Wu's user avatar
  • 1,257
1 vote
2 answers
460 views

Tcl SQLite update variable substitution cannot have apostrophe

Here's the problem: if I use { } for the update command like so: package require sqlite3 fileRepo eval {UPDATE uploads SET $col=$data WHERE rowid=$id} I cannot substitute any variables inside the ...
MetaStack's user avatar
  • 3,626
1 vote
2 answers
2k views

Python: Substitute variable values before passing to another function

I want to determine whether the input string is a valid function name or not. Is there any way to substitute the value of the variable before being passed to isfunction call ? #!/usr/bin/python def ...
Ashwin's user avatar
  • 1,003
1 vote
1 answer
59 views

Converting Linux style substitutions to Windows style substitutions in Python

Is there a way to convert Linux style shell substitutions to Windows substitutions in Python? Let's say there's a command in a Linux environment: my_command=cd ${my_command} .. OR $my_command .. ...
Andrew's user avatar
  • 1,405
1 vote
2 answers
1k views

Does R support indirect variable expansion or variable substitution?

In bash one can use an exclamation mark to use a variable's value as a variable. See explanation here. This is known as variable indirect expansion. This can be used to used to name a new variable ...
Gabriel Fair's user avatar
  • 4,280
2 votes
2 answers
290 views

combining tilde expansion with variable substitution in bash

Say I'm running bash as root, and I want to chown the home directory of a user ada. Say also that ada is stored in a variable called $USER (because I'm doing this from a script). When I tried the ...
Chris Middleton's user avatar
0 votes
1 answer
360 views

Use string as bash variable name in alternative value expansion [duplicate]

How can I use the value of one variable as the name of another variable in an alternative value expansion (${var+alt}) in bash? I would think that #!/bin/bash cat='dog' varname='cat' if [ -z ${`...
Chris Middleton's user avatar