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

Replace IP addresses with filename in Python for all files in a directory

If I knew the first thing about Python, I'd have figured this out myself just by referring to other similar questions that were already answered. With that out of the way, I'm hoping you can help me achieve the following: I'm looking to replace…
oompaloompa
  • 3
  • 1
  • 5
0
votes
0 answers

nginx replace a plus for a dash

I am very new to nginx but i have been tasked with doing some rewrite rules to cover a new URI structure as part of a website migration. I have browsed this site and i see that there is a solution that I'm not sure will work for us. Basically i take…
0
votes
2 answers

Automating substitute expressions in vim

What is a good way to automate substitute commands in vim? Suppose I have something like: s/foo/bar/g except much more complex and I want to run it on selected ranges without having to type the substitute command? How can I save the substitute…
Petr Skocik
  • 58,047
  • 6
  • 95
  • 142
0
votes
2 answers

oneliner -- multiple file substitution transformation produces out-of-sync results

Context perl 5.22 multi-file transformation with perl oneliner Overview TrevorWattanStewie has a directory full of config files, and he wants to transform them. The transformation operation is best understood by comparing "BEFORE" to…
dreftymac
  • 31,404
  • 26
  • 119
  • 182
0
votes
2 answers

Sed substitutes just once instead of multiple times

I've got an XML-file with lots of the following code: I need to replace code="NL" with code="IBA", but only when the BankAccount has INGB000 in it. I use the…
Apojoost
  • 127
  • 10
0
votes
1 answer

Returning the date from varied data, where the date is formatted in text and the days vary digits from 1 to 2

Data -----------------| ----- Formula ---|------------------- Date (Output) ------------------------------ (name - Aug 7, 2015) --------------------------------------------------------- 07/08/15 | -'}{[]//-;'; (lots of characters) (name - Aug…
G198
  • 43
  • 6
0
votes
1 answer

EDIT Return the correct date value when the character amount changes

I need this data to be formatted as a date and the only issue with my current formulae, is that some of the data shows only one digit as the day when the rest show two digits. Below shows the current formulas, the data always appears as this, in…
G198
  • 43
  • 6
0
votes
2 answers

Replace periods with substitution in bash script using perl except questionmark or exclamation mark

Originally I figured out how to remove the periods for all the files and then add them back: Remove periods at end of titles perl -pi -e 's/title = \{(.*)\.\},/title = \{$1\},/g' $1 # Add periods back so all files are the same (comment out if no…
J Spen
  • 2,614
  • 4
  • 26
  • 41
0
votes
1 answer

Using xargs basename in Makefile

I have a working solution from an earlier question I asked for finding csv files in a source directory (/foo/source), chopping off the first 233 lines using tail, and saving that to a file in a different directory (/foo/dest): find /foo/source -name…
James Allen
  • 6,406
  • 8
  • 50
  • 83
0
votes
2 answers

Simple Spring Property Substitution

So I have a spring configuration file:
0
votes
1 answer

Partial substitution / removing characters within regex matches

I'm trying to remove the characters \/<>~?`% if they appear within three <'s and >'s. For the string: Multiple <<<parameter>>> options %to <<<test/verify>>> in <<<one%…
aneroid
  • 12,983
  • 3
  • 36
  • 66
0
votes
1 answer

Substituting Values for days when the Stock exchange was closed. ( R )

Let's say I have downloaded some stock market data. Now, I am making it as a date list with continuous dates: Now I need to assign a value of previous Friday to Sat and Sun. Whenever the stock market was off (like holidays or something), I need…
Shiva Prakash
  • 1,849
  • 4
  • 21
  • 25
0
votes
3 answers

Excel replace characters in string before and after 'x'

Hello I have a column with strings (names of products) in it. Now these are formatted as Name LenghtxWidth, example Green box 20x30. Now I need to change the 20 with the 30 in this example so I get Green box 30x20, any ideas how I can achieve…
Jesse
  • 727
  • 13
  • 44
0
votes
2 answers

Predefining a complex replacement for substitution

I am trying to use variables in s///. This example code works as expected: my $regex1 = "e"; my $regex2 = "2"; my @array = ("one two three", "green blue red"); $_ =~ s/$regex1/$regex2/gee foreach (@array); print $_ foreach (@array); However, if…
Erik Olson
  • 197
  • 8
0
votes
2 answers

wrap a variable number of instances in a string with parenthesis in python

I have a string that contains variable names separated by 'and's/'or's such as 'x[1] and x[2] or x[3]'. The number of variable names varies as does whether it's an 'and' or 'or' that comes in between them. I want to wrap parenthesis around each…
1 2 3
99
100