Operations that locate specific instances of conditions being met and replacing them.
Questions tagged [find-and-replace]
707 questions
248
votes
3 answers
How to delete all lines that do NOT contain a certain word in Vim?
In vim I can delete all lines that contain the word "price" with this
:g /price/d
How can I delete all lines that do NOT contain the word "price"?
digitaljoel
- 2,863
166
votes
10 answers
How can I do a recursive find and replace from the command line?
Using a shell like bash or zshell, how can I do a recursive 'find and replace'? In other words, I want to replace every occurrence of 'foo' with 'bar' in all files in this directory and its subdirectories.
Nathan Long
- 27,435
77
votes
10 answers
How to remove this symbol "^@" with vim?
I have some files that are corrupted with this symbol:
^@
It's not part of the string; it's not searchable. How do I substitute this symbol with nothing, or how do I delete this symbol?
Here is an example line from one…
mrt181
- 955
69
votes
2 answers
Search and replace with TAB character in Sublime Text 2
In Sublime Text 2, I want search and replace by the TAB character.
I tried replacing with \t char but it's not working.
How can I do it?
shingara
- 793
34
votes
4 answers
Using -replace on pipes in powershell
I want to test out a replace before I use it, so I'm trying to write a quick online command to see what the output is. However, I'm not sure what the syntax is. What I want to do is something like
cat file | -replace "a", "b"
What is the correct…
34
votes
2 answers
How to find and replace the character "*" in Excel
I am trying to find and replace the * (star, or shift+8) character in a bunch of formulas in Excel 2007. * of course matches the ENTIRE contents of the cell, which is not what I want. How do I disable this behavior?
Zach
- 505
31
votes
4 answers
How to do an inverse search in Vim? (i.e., get lines not containing pattern)
With grep I can do a grep -v "my search" to get all the lines without "my search".
With sed I can sed '/baz/!s/foo/bar/g' to find replace text on lines with out "baz".
Is there a way to do the same thing in Vim? And is it possible to do it without…
nelaaro
- 14,139
- 30
- 88
- 115
30
votes
5 answers
Replace newline character with another in Word 2007
Using Microsoft Word 2007, is it possible to replace the newline character (\n) with some other character?
What about vice versa? (That is replace a character with the newline character).
amir joudaki
29
votes
7 answers
How do I find and replace a character in filenames in Windows 7 using Explorer?
I want to replace all the underscore characters (_) with a space () in a filename.
How can I do this quickly, when I have lots of _ characters to replace?
Nam G VU
- 12,548
28
votes
8 answers
Use Notepad++ to change under_score_case to CamelCase?
I can write a regular expression in NP++ to find under_score_case.
I can use TextFX in NP++ to change case to upper and lower case by highlighting and selecting.
How can I use either NP++'s Find/Replace or TextFX's find and replace to stitch these…
Freiheit
- 669
28
votes
3 answers
How can I use newline with the Find-And-Replace in Visual Studio?
I've become rather fond of the "Find-And-Replace" function in Visual Studio. The function lets me replace phrases, words, symbols, or whatever you can type into the textbox on the screen.
How can I make it replace a character with a newline?
Vivian River
- 545
26
votes
8 answers
Find and Replace several several different values all at once
I have a file with multiple instances of Text_1 and Text1 and I need to replace both those strings with Text_A and TextB respectively.
Currently I'm doing two Find and Replace functions on each file one that finds Text_1 and replaces it with…
matt
- 1,519
26
votes
8 answers
Find and Replace in Excel: Can one restrict to just one column?
This should be simple but I'm having trouble with it even so: I want to FIND a short piece of text at every one of its occurrences in one column, and REPLACE it with nothing, leaving the text in every cell which has been altered in that column…
George
- 361
25
votes
9 answers
Regex Replace from Command line
Is it possible to regex replace from command line? Right now I'm using notepad++ to do this. In command line I can only use FINDSTR wich can only locate the mached files/lines
EDIT : Maybe it will be possible to make a VB script and run it from…
Aziz
- 597
20
votes
3 answers
Can I search and replace in a Notepad++ macro?
I'm trying to create a macro in Notepad++ that allows me to do a few standard Search & Replaces. I can get the macro to do everything (add lines, add characters) except search and replace.
I can't find the files to edit the macro manually.
Has…
Konerak
- 1,915
- 3
- 20
- 29