Possible Duplicate:
Editing a text file in place through C#
I need to replace a line in a very big file , so I don't want to readAll and writeAll - I want to get to the line requiring replacement , replace , and close the file.
Any idea how to do it in C#?
Thanks!
...
I am trying to do a simple find and replace within a string with:
$share_name = str_replace(" ", "\ ", $share_name );
Unfortunately for some reason it replaces all the spaces with "\\ " instead of "\ ". Does anybody know whats going on and how to solve this problem?
...
Hi All,
I'm trying to find and replace all instances of 'this phrase' with 'that phrase' in an xml type column using T-SQL.
The xml column contains fields that are more than 8000 characters long.
I tried using the Replace function but it doesn't like the XML data type, and the data can't be squeezed into a varchar.
Phil
...
I have a CSV file containing some user data it looks like this:
"10333","","an.10","Kenyata","","Aaron","","","","","","","","","",""
"12222","","an.4","Wendy","","Aaron","","","","","","","","","",""
"14343","","aaron.5","Nanci","","Aaron","","","","","","","","","",""
I also have a file which has an item on each line like this:
a...
Is there a mysql query to find and replace parts of field names?
I know you can do that within the actual data using
update [table_name]
set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
... but how do you do that for the actual field names?
I have some fields with a - in the name, and I'd like...
I'm using a DataGrid to display the values of specific properties of a collection of objects. I've implemented search and cell highlighting through a similar method to the one on Tomer Shamam's blog.
However, I now need to implement 'Find/Replace' type functionality. I presumed I would be able to iterate through the DataGrid's cells to ...
I'm trying to do a find and replace over many files within an Eclipse project, but I can't seem to find a way to do it. Googling showed me that there are plug-ins that can accomplish this, but is there any built-in functionality in Eclipse? (It seems to be a pretty basic task; it's surprising me that I can't find a way to do it.)
...
I have a large codebase, where we need to make a pattern-change in the argument of a specific function.
i.e. All arguments to a function foo() are renamed from the format something.anotherThing are to be renamed as something_anotherThing
The arguments can be anything but will always be in a str1.str2 format. It is to be done for argume...
I try to get all occurences of a pattern from a file, but currently I fail if there is more than one occurence per line.
Sample line in file:
lorem ipsum foo="match1" lorem ipsum foo="match2" lorem ipsum
The output I want:
match1 match2
I tried getting this using sed:
sed -ne 's/^.*foo="\([^"]*\)".*$/\1/p'
With this expression ...
I need a regular expression to uncomment a block of Perl code, commented with # in each line.
As of now, my find expression in the Eclipse IDE is (^#(.*$\R)+) which matches the commented block, but if I give $2 as the replace expression, it only prints the last matched line. How do I remove the # while replacing?
For example, I need to...
Just starting out with jQuery and this problem seems to be impossible to me.
Search all the forums, no luck. Maybe you guys can help me?
My html looks kinda like this:
<form>
<table class="tableClassName">
[content]
</table>
<div class="divClassName">
[content]
</div>
Here is some text
<div class="divClassNam...
I need to convert about 5,000 subtitles from a proprietary format to SRT format. Doing so involves numbering each subtitle. I can easily use TextWrangler's Find & Replace to prepend each subtitle with an asterisks or some other placeholder, but what's the easiest way to convert those asterisk (or whatever I use as a placeholder) into s...
I require a regular expression for the Visual Studio Search and Replace funtionality, as follows:
Search for the following term: sectorkey in (
There could be multiple spaces between each of the above 3 search terms, or even multiple line breaks/carriage returns.
The search term is looking for SQL statements that have hard-coded Secto...
Basically, what I'm doing right now is running an XSLT, then opening the result in Visual Studio and doing a find and replace for one word - for this example, I want to change all instances of "bar" to "myBar". All instances of "bar" may be assumed to be in text elements like so:
<someElement>bar.whatever</someElement>
This would be t...
Here is my text:
<span class="c1">Testing "this string"</span>
and I want to end up with this:
<span>Testing "this string"</span>
so I tried to use this regex in Notepad++ to replace with nothing:
class=".*"
but that matches this:
class="c1">Testing "this string"
How do I stop that match after one instance of "?
...
Hello everybody,
This question is an extension of this one. I have many values, as seen below:
<myStuff>
<elem1>asdf</elem1>
<elem2>foo bar</elem2>
<elem3>foo bar foo</elem3>
<elem4>foofoo</elem4>
</myStuff>
I've been doing a copy-of over MOST the elems (the select in the copy-of is very specific) and then doing a fin...
Hi,
I want to make a program that will search and replace some words occurrence in a file. I am using xcode. I want to do this programmatically using some standard free API in a MAC application.
...
I am trying to use JQuery to search and replace all instances of a given string. JQuery was the only method I found which doesn't force-reload the whole page. This is what I have right now:
<script>
$("*").each(function () {
if ($(this).children().length == 0) {
$(this).html($(this).html().replace('0101','0102'));
}
});
...
>>> teststring = 'aõ'
>>> type(teststring)
<type 'str'>
>>> teststring
'a\xf5'
>>> print teststring
aõ
>>> teststring.decode("ascii", "ignore")
u'a'
>>> teststring.decode("ascii", "ignore").encode("ascii")
'a'
which is what i really wanted it to store internally as i remove non-ascii characters. Why did the decode("ascii give out a uni...
VS2008 allows you to use regular expressions in the find/replace dialogs.
I've run into a couple of moments where I've needed to copy the case of a specific character and impose it on the replace string.
For example I have a block of code that has Monday and monday scattered throughout. I want to change each Monday to a Friday as well...