Questions tagged [substitution]

The action of replacing something with another thing.

Filter by
Sorted by
Tagged with
-2 votes
2 answers
60 views

Substitue values in jq from a txt file

I'm executing jq like this: jq '.backups[] | select(.resource_name == "resource_name") | {BackupTime: .updated_at, DiskName: .resource_name}' js.json | head -4 Is there a way to substitute ...
Harsha Vardhan's user avatar
1 vote
0 answers
44 views

Modifying a global variable works, but not when a pipe is used [duplicate]

Changing a global variable in a bash script works perfectly. But when a pipe is used it stops working as expected. This works: pf_test1: #! /bin/bash echo "1) MyGlobal=${MyGlobal}" source ...
JohnA's user avatar
  • 721
0 votes
0 answers
4 views

Turn off infuriating Xcode editor completions

I type false and Xcode substitutes that to FALSE (.swift file). Now which of the multitude of autocomplete checkboxes in text editor settings I need to uncheck to stop that? So that ESC sequence ...
Anton Tropashko's user avatar
1 vote
3 answers
59 views

Replace everything from string1 to string2 in file including newlines

I have a file with content like this: (marked as js for better readability only, could be any plain text file) some text /*%SKIP% line comment %SKIP%*/ some text /*%SKIP% block comment I could contain ...
stuck1a's user avatar
  • 25
1 vote
1 answer
73 views

Ruby replace backslash with double backslash in a String [duplicate]

I have this little problem that bugs me. I need to double every backslash in a string, for exaple, If have a string 1 \ 2, I whish to transform it into 1 \\ 2. I don't see why the code below fails. ...
Nicola Mingotti's user avatar
0 votes
2 answers
94 views

Replacing last four digits in a set of numbers that are separated by dashes

I have a bunch of numbers similar to SSNs in format, and would like to change the final number set to the same. So if the number structure is like this "123-45-6700", I want to have a ...
user17432547's user avatar
0 votes
0 answers
24 views

Find or combine formulas in order to get a variable, based on a supplied list of formulas and input values in JS

As the title says, I need to find or combine formulas in order to get a variable e.g. "A" based on a supplied list of formulas and input values like this: const formulas = [ "FW=0.5*...
ConfusedDuedSquared's user avatar
0 votes
1 answer
59 views

What is the meaning of these prolog sentences? (substitution)

I'm just beginning to learn Prolog and I've come across this example for substitution: We have the substitution S2 = {X= brother(maya), Y = friend(john)} We apply the substitution S2 to friend(X, Y) : ...
Vivian's user avatar
  • 1
2 votes
1 answer
39 views

Passing unevaluated expression to substitute + eval combo

I am trying to pass an expression that should be evaluated with respect to the data frame, essentially mirroring the subset(). The issue is, I need to be able to have it inside other functions. This ...
Colombo's user avatar
  • 407
0 votes
1 answer
47 views

Excel formula to manipulate cell text

I have this text value in an excel cell: ,!Đ49,-,Đ50*,!Đ173,-,Đ174*,Đ197,-,!Đ198,-,Đ199*,Đ264,!Đ314,-,Đ315*,Đ330, I need to manipulate it to reach the following result withotu VBA: ,Đ49,-,Đ50,Đ173,-,...
D.Moore's user avatar
  • 47
0 votes
2 answers
67 views

How do I add a pattern to an existing pattern with sed

I'm trying to add 'pp. ' to the following paginations but it doesn't work: grep -n -o -E --color "\b(pp.\s)?\d{1,3}–\d{2,3}\b" references.txt 3:pp. 610–623 5:102–114 8:58–70 10:245–258 12:...
Peilin's user avatar
  • 33
0 votes
1 answer
36 views

f(x).subs() substitution in sympy

I'm trying to find a way to substitute a variable by another one in a function. (not in an expression) in the example below, in the function v(t), I want to substitute the variable t0 by the value 0. ...
Damien Dambre's user avatar
0 votes
0 answers
63 views

How to replace a large substring in a file?

Have a file containing multiple lines. But in some lines, there's a large substring need to be sorted. Now I got the substring and sorted substring, both stored as variables. Is there a way to replace ...
Alan Gatsby's user avatar
0 votes
0 answers
56 views

=IF(ISNUMBER(SEARCH(SUBSTITUTE

I have two working formulas =SUBSTITUTE(J136,"SE Ext '22","OE 23") This is being run in column C and =IF(ISNUMBER(SEARCH(K136,C136)),"Matches","Review Req") ...
cpht's user avatar
  • 77
0 votes
1 answer
44 views

zsh: How to pass a variable into a command?

I have a one-line instruction that works if I put put in a constant, like so: westk@westkent:~$ echo $dat | jq -r '.[] | select(.Name == "ADM111_1")' { "ID": 300035, ...
DebianFanatic's user avatar
-1 votes
2 answers
44 views

Fish command substitution for arguments -- eval safe?

In fish shell, I want to be able to expand a command substitution or variable as multiple arguments to another command, e.g.: Without substitution ls -l -h Should give the same result as: ls $(echo '-...
Rogus's user avatar
  • 1,228
0 votes
1 answer
67 views

How do I use SymPy to simplify by substitution a number of equations to get to a single simplified equation?

My question is exactly like the title of my post. Attached is an image with an example of what I would like to achieve. Description of problem I have updated this file after the original post and ...
Data Lark's user avatar
3 votes
3 answers
115 views

More eloquent solution for SUMIF of two tables, based on number of countries occurring in cell of table A, divide the corresponding number in table B

I have two tables (lets say A + B). Table A includes a number of vehicles to be driven in a set of countries. Table B includes the planed driven KM per country, from Table A. (Table A and Table B are ...
Lixxy's user avatar
  • 53
0 votes
2 answers
40 views

How to substitute a sequence of the same character and of variable length in bash?

I am quite sure this question already have an answer, but i can't find it so if there is one, please link it in the comments. Otherwise, the problem i need to solve is how to substitute a sequence of ...
gabt's user avatar
  • 698
0 votes
1 answer
26 views

How do I make a pattern based replacement in sympy which recognises factors of any form?

I want sympy to replace, any time it sees an expression of the form factor1 * exp^{ - factor2 * x^2} with an expression expr1. Here, I want sympy to recognise the pattern everytime factor1 and factor ...
Prem's user avatar
  • 101
0 votes
0 answers
77 views

How to rewrite a complicated expression in terms of several defined functions in Mathematica

I have a long expression in mathematica that contains various unevaluated definite integrals and numerous parameters. I also have other functions whose definitions contain these integrals, and I know ...
Entropy Reducer's user avatar
0 votes
0 answers
10 views

Finding equivalent strings through substitutions

I have a problem that's proven to be dramatically more complex than it at first seemed. I have a (long) list of equivalence relations of the form e = abe. I need a function from string to string that ...
Nol's user avatar
  • 75
0 votes
3 answers
100 views

vim :s command with regex to select a second occurance of a character

I want this block of text below :- 119, 'Youth Campus,Janakpur', Janakpur 978, 'Yog Kumar Janta Campus, Balwa-3', Mahottari 806, 'Yerawati Aadarsha Multiple Campus, Lalmatiya Deukhuri, Dang', Dang ...
prateek khanal's user avatar
1 vote
2 answers
86 views

Order of Command substitution and Arithmetic expansion in bash

The book “Learning the bash Shell” 3rd ed. by Cameron Newham and Bill Rosenblatt has at page 181 a picture describing the command-line processing of bash shell. That picture shows that Command ...
diciotto's user avatar
3 votes
2 answers
102 views

Getting rid of repeated "Use of unititialized value $foo in pattern match" errors in big set of substitutions

I have a Perl script that builds a hash of symbols from C source files that are longer than X characters, then substitutes a string of A[0-9]{5}. The number increments with each successive symbol to ...
Frotz's user avatar
  • 542
0 votes
0 answers
44 views

How to use a substitution variable in Toctree Sphinx?

The problem consist to use a substitution variable var_link which is declared in conf.py file as follow : var_link = 'https://www.google.fr/' This variable is added into rst_prolog by rst_prolog = f&...
Elarif269's user avatar
0 votes
1 answer
9 views

How can I print input \t as tabs?

I'm trying to write a program to substitute characters I input. I want to replace the words "is a" with two tabs, which I write as \t\t. When I input \t\t, the output says a literal \t\t ...
Patrick T. Stingley's user avatar
-2 votes
1 answer
39 views

Allow alternative values to be compared to an exiting list

I am trying to check if a word is in a list, but allow for replacements. cars = [green_2door, Kelly_4door, ruby_2door] car_colors = {} colors = ['red', 'blue', 'green', 'purple'] allowed_colors = {'...
n3wb's user avatar
  • 7
0 votes
0 answers
84 views

draw.io %varaible% titleblock text substition in a multisheet document

Problem: want to set a document local variable once (using CTRL+M) ONCE and then re-use the %var% in a common title block used on EVERY sheet in THIS document Seems you can export CTRL+M properties, ...
Ian Finlay's user avatar
0 votes
2 answers
125 views

Bash process substitution in string

I'm trying to add a switch to a script which will make a parameter on an internal command optional. Normally, I'd do this by either using a conditional to run the command with the parameter or without ...
Component 10's user avatar
  • 10.3k
2 votes
2 answers
115 views

How to use an expression in the replacement side of the perl substitution operator?

I'm pretty new to perl and facing one issue. This might sound as a silly question but I want to understand it well. So I've a string variable containing a substring which I want to replace with a ...
Biswajit Maharana's user avatar
0 votes
1 answer
74 views

Disable SVN keywords expansion for `svn checkout` / `svn update`?

While it is possible to do it with svn export, I found no way to do it with svn checkout or svn update. svn export is not sufficient in my case because it does not seem to work with files that have ...
Gabriel Devillers's user avatar
0 votes
0 answers
28 views

How do you substitute a string from within a macro in GAS?

I have a macro which exposes global variables to the linker from a source file compiled by GAS. .macro GLO NAME .global foo_\NAME foo_\NAME: .endm If i write... GLO var ....
mm1999's user avatar
  • 1
1 vote
1 answer
96 views

Regex replace: return empty none/empty string if no match

So i thought i know a bit of regex but it seems i found a case where my knowledge is at is end. Anyway i tried the following Regex Replace function: in cases of no match, $1 returns full line instead ...
Tollpatsch's user avatar
0 votes
1 answer
23 views

Conditional value imputation: Setting 'Not available' to 0 for non-smokers?

I have a question about a problem with imputation of values in R. In particular, I have two variables: a categorical variable called "Do you smoke" where the survey asked if a person is ...
Francesco Lo Riso's user avatar
1 vote
2 answers
86 views

Multiple line search and replace bash sed

I have a file called tst.txt that contains text: exec(compile(open(bla bla bla')) DATE = "05JUN20" Only capture the below line params = {'System_Date': getparamDate(DATE), 'Param': '2'} This ...
Totoc1001's user avatar
  • 348
0 votes
1 answer
23 views

Substitute labels in text for the first letter of the label

So, I am currently working with texts with labels inside with the R language. The labels go between **, for example: text <- "The fir*s double*t day o*f lost* the *w strange*eek" I would ...
isimaralv's user avatar
0 votes
2 answers
56 views

Sympy: substitute list of symbols with list of values in list of expressions

I have a list of expressions Fa = [F0, F1, ... Fn] , containing expressions like F0 = 2*x0 + 5*x1 - x2 F1 = 3*x0 - x1 , with sympy symbols SymList = [x0, x1, ... xn] Now I have a list of values ...
DozerD's user avatar
  • 1
1 vote
1 answer
48 views

Substituting Names in Google Sheets

I am looking for the best away to transfer and change to name in a cell. Example: I have a table of acronyms such as: LRG, LAA, LBG I want to create a function that lists the full names in a table ...
user21897381's user avatar
-1 votes
1 answer
275 views

YAML - Assign single value to multiple keys

I have a YAML configuration file and there are multiple keys that need to be assigned with the same value, so I was trying to figure out a way to do so but nothing seems to be working. Below is my ...
Shantanu Srivastava's user avatar
0 votes
1 answer
140 views

How can I replace a specific part of an URL with Google Sheets

I tried a lot of things with Regexextract and Substitute but I can't get it to work so I hope someone can help me on this. We have a link structure with the category name in the second '/ /' part of ...
Sami Chouchane's user avatar
0 votes
0 answers
28 views

Substituion of a Let(name, bound, body)-Expression (pseudo code)

one of my tasks in my studies is to consider which of those possibilities of that pseudo-code is right. I have to take care about variable shadowing and variable capturing. Here's following task: (let ...
Opticpeak's user avatar
0 votes
2 answers
26 views

Using secret env value in env in cloudbuild step

I have a build pipline defined as such: - name: 'ubuntu' env: - 'URL="$$_URL/movies"' secretEnv: ['_URL'] script: 'echo URL' availableSecrets: secretManager: - versionName: ...
Gryfit's user avatar
  • 23
0 votes
0 answers
25 views

How to execute A command with output of B command [duplicate]

I want to substitute an output of a command with another command. In this case, I would like to take uuid and baseboard-serial-number of the machine using **dmidecode, **but those do not work on WSL ...
Sayyid's user avatar
  • 1
4 votes
2 answers
164 views

how to build back a splitted and updated string?

With the follwing code I split a string, create a list, and given a specific pattern, substitute a random char with another one comando = "/bin/cat /etc/passwd" payloadMUT1 = comando ...
jagghy's user avatar
  • 127
0 votes
2 answers
567 views

How can I update substitutions values of google cloud build trigger using bash script?

I want to write a script where I will pass the values and the script will update all the substitutions values automically. In cloud build trigger, I am passing values like _DOCKER_IMAGE, _IMAGE_TAG, ...
Md. Omar Hasan's user avatar
2 votes
1 answer
59 views

Python - Extract a regex match AND substitute it in one go?

I want to remove leading white space from a string but also extract it. I went with: m = re.search( r"^(\s*)", text ) leading_space = m.group(1) text = re.sub( r"^\s*", ""...
Gibril's user avatar
  • 21
0 votes
0 answers
55 views

How do I see if a cell contains any word from a separate list, and then return a value from lookup?

I have a list of product names and then a list of confirmed trademarks (on a separate tab) that need to be applied for different countries. I want it to append/substitute the appropriate trademark to ...
Jess's user avatar
  • 1
0 votes
1 answer
39 views

Transforming dataframe column into the right format (Python using Pandas) [duplicate]

Here my problem (assume that I already imported Pandas as pd and so on...): I have a data frame called "x" It contains several columns, one of them called "Time" Time has dates in ...
ALB_BUV's user avatar
0 votes
1 answer
161 views

Why does the Excel formula substitute not work for me?

Sorry... I had originally posted this as an answer :-) I have a spreadsheet that uses various formulas. When I get to some of the lists, some containing 16 items, I am concatenating 16 different cells,...
Dave's user avatar
  • 1

1
2 3 4 5
38