Questions tagged [substitution]

The action of replacing something with another thing.

The action of replacing something with another thing.

1879 questions
0
votes
1 answer

substitute constant to a formula matlab

I define in MATLAB: syms k2 k3; k1 = k2/k3; Where k2 and k3 are symbolic variables. Then typing k1 gives the output: k1 = k2/k3 Assign constant value for k2 and k3: k2 = 1; k3 = 2; Then I type in matlab commandline: >> k1 k1 = k2/k3 Is there…
Karim
  • 252
  • 1
  • 4
  • 17
0
votes
1 answer

Random Substitution Cipher (Python)

I'm writing a random substitution cipher, and it works well when being used to write regular sentences. However, when I try to test 'abbcccddddeeeee', I will get something back like 'G H H I I I J J J J K K K K K'. How can I change my code so that…
0
votes
1 answer

Changing colnames by lookup

I have a data frame where the upper left looks like this: Row.names Chrom Position GT_1 GT_10 GT_100 GT_101 GT_103 1 SST4.03CH00_1006820 0 1006820 TTTA TTAA TTTT TTTT 2 SST4.03CH00_1006822 0 1006822 CCCC …
SigneMaten
  • 493
  • 1
  • 6
  • 13
0
votes
2 answers

Substitution error in bash

Here is the code: declare -A data84 data84=( [Tom]=23 [Lucy]=32 ) function test() { data=$1 echo ${${data}[Tom]} #error 1: "${${data}[Tom]}" bad substitution a=${data}[Tom] echo ${a} #output unwanted result data84[Tom] } test…
user6948979
  • 65
  • 2
  • 9
0
votes
1 answer

How do I remove non-letters from the beginning of the string

I'm using Ruby 2.4. How do I remove non-letters from the beginning of my string? I thought I could do something like name ? name.sub(/^[^a-z]*/i, "") : nil but this neglects things like an accented a ("á") or that type of "u" with the dots above…
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
2 answers

Substituting part of a function with variable input

I want to substitute parts of the transform function with variable inputs. I have created a df using subset with col1 from an existing table: col1 = c('A','B','C') The df looks something like this: A = c(1, 3) B = c(3, 1) C = c(5, 2) df =…
Daan11
  • 67
  • 1
  • 2
  • 7
0
votes
2 answers

SEARCH and SUBSTITUTE Multiple value

Column D is result of LOOKUP from Column C A B C D 1 1234 1234567 Person1 ASKXXXXXXXX 2 3692 8465837 Person2 AFTXXXX I need to replace X's in D with B if there are 8 of them, and to replace X's in D with A if…
silver_river
  • 169
  • 1
  • 10
0
votes
2 answers

Replacing a string with a different string on a table in sql

Good afternoon people. I'm trying to replace a result from a query in a particular column in sql. the table is as follows: +-----------+----------+-------+-------+---------+ | firstName | lastName | major | minor | credits…
mr_nyo
  • 99
  • 1
  • 9
0
votes
1 answer

combine mid and substitute

Is it possible to combine the MID or RIGHT function with the Substitute function and make that conditional on the value of another cell. I have two columns one is a product code, starting from the 8th character there are 3 letters that correspond to…
0
votes
1 answer

(Bash) How to substitute many files into the script?

I have script which is taking one argument ($1). So I run it like this: bash script.sh file1.txt. But when I want to substitute more files (bash script.sh *) then he only takes one file from all. How can I make it work? Should be there another…
Anna
  • 39
  • 1
  • 9
0
votes
4 answers

Substituting specific string using sed followed by a dot (.)

I am doing some substitution in files as follows: file: abc.txt `include foo.h int main { int foo foo and bar barfoobar } I want to replace 'foo' inside the braces, but I don't want to replace the 'foo' written in the include directive. I tried…
0
votes
3 answers

iterate through object properties and change current property in a loop in objective-c

Newbie question: Can one substitue commands, properties or methods for NSStrings or char at runtime? Lets say I do something like this: //these are the names of my properties of an NSObject I created char theChangingProperty[17][18] = {"name",…
NSDestr0yer
  • 1,419
  • 16
  • 20
0
votes
1 answer

Python re.sub always matches?

I have an array that looks something like: mylist = [ "blah blah hello", "\nbarnacles and stuff()", "\nhello again", "\nother stuff )" ] And my regex is like the following: s = 'hello' rx = re.compile(s + '.*') newlist = [ rx.sub(thing, '')…
josiah
  • 1,314
  • 1
  • 13
  • 33
0
votes
1 answer

Substituting cell values in Excel based on matching criteria

I'm not sure is my Title correct, but I don't know how else to put it. Not an Excel expert so I would need help here. I'm having COL A and COL B, COL A containing a name and COL B containing a link to COL A. All values in COL A and COL B are…
user4042721
0
votes
1 answer

How to escape ] char in character class in sed

echo "eh]" | sed -r 's/[\]a]/lol/g' returns eh] instead of ehlol. no errors are raised so I assume \] is some kind of sed magic. Im tired of constant sed problems, but I have to use it. so how to escape ] in sed substition expression?
nah
  • 13
  • 2