So my code isn't working...
test.c:27: warning: passing argument 1 of ‘search’ from incompatible pointer type
which is the fgets line.
My code opens a file, reads the file line by line, and I'm trying to create a "search" function that will return a value that indicates whether that string is found on that line of the file.
My ultim...
Given the following line:
[aaaa bbbb cccc dddd] [decimal](18, 0) NULL,
How would you replace the spaces only between the first set of brackets in Vim? What would the /s command look like?
Update:
This is the intend outcome
[aaaa_bbbb_cccc_dddd] [decimal](18, 0) NULL,
...
I don't know if I can use regex for this, but I want to replace something in this xml:
<custom-attribute name="Attribute_1" dt:dt="string">Danny Boyle</custom-attribute>
<custom-attribute name="DVD-releasedatum" dt:dt="string">06/10/1999</custom-attribute>
should become
<Attribute_1>Danny Boyle</Attribute_1>
<DVD-releasedatum>06/10/1...
I want to recursively search through a directory of text files and replace every occurrence of foo within the files with bar. What is the easiest way to accomplish this?
I imagine that grep would do the job in one line, but I can't seem to find an example of this.
I'm working in OS X.
...
I would like modify HTML like
I am <b>Sadi, novice</b> programmer.
to
I am <b>Sadi, learner</b> programmer.
To do it I will search using a string "novice programmer". How can I do it please? Any idea?
It search using more than one word "novice programmer". It could be a whole sentence. The extra white space (e.g. new line, tab) sh...
I'm using regex to match all non-quoted property names in my json files. Eclipse has no problem finding the desired matches, but when I want to replace the matched strings with "$2", I get this error: Match string has changed in file filename.json. Match skipped
Here's the regex I'm using:
((\w+)\s*(?!['"])(?=:))
Any idea on how to w...
Hello all,
I have a WordPress blog with numerous URL's I wish to replace from this:
http://www.oldwebsite.co.il/name/*.asp
To this:
http://www.newwebsite.com/?p=*
For example, from this:
http://oldwebsite.co.il/name/65971.asp
To this:
http://www.newwebsite.com/?p=65971
I believe the following plugin:
http://urba...
I found this command line search and replace example:
find . -type f -print0 | xargs -0 sed -i 's/find/replace/g'
It worked fine except it changed the date and file ownership on EVERY file it searched through, even those that did not contain the search text.
What's a better solution to this task?
Thanks.
...
How can I add http://facebook.com to relative URL's contained within #facebook_urls? Eg:
<a href="/test.html">
becomes
<a href="http://facebook.com/test.html">
#facebook_urls also contains absolute urls, so I want to make sure I don't touch those.
Thanks!
...
I have a perl script (or any executable) E which will take a file foo.xml and write a file foo.txt. I use a Beowulf cluster to run E for a large number of XML files, but I'd like to write a simple job server script in shell (bash) which doesn't overwrite existing txt files.
I'm currently doing something like
#!/bin/sh
PATTERN="[A-Z]...
[Update2] As it often happens, the scope of the task expanded quite a bit as a understood it better. The obsolete parts are crossed out, and you find the updated explanation below. [/Update2]
I have a pair of rather large log files with very similar content, except that some strings are different between the two. A couple of examples:
...
I am looking into changing the file name of hundreds of files in a (C/C++) project that I work on. The problem is our software has tens of thousands of files that including (i.e. #include) these hundreds of files that will get changed. This looks like a maintenance nightmare. If I do this I will be stuck in Ultra-Edit for weeks, rolling ...
I'm pretty new to Python programming and would appreciate some help to a problem I have...
Basically I have multiple text files which contain velocity values as such:
0.259515E+03 0.235095E+03 0.208262E+03 0.230223E+03 0.267333E+03 0.217889E+03 0.156233E+03 0.144876E+03 0.136187E+03 0.137865E+00
etc for many lines...
What I ...
I need to find all strings without a given string before it.
For Instance:
Find: "someValue"
**All results with "function(" before them should be ignored
The Visual Studio regular expression would find this:
value = someValue
And Ignore something looking like this:
function(someValue)
What is the best way to go about this?
Th...
Query to Where X update Y and where A update B in a Mysql Table column.
How can I Do this in MYsql in one querry on the same column in a specific table.
I want to search and replace multiple values in a table column.
Conditons in table1 in column1
Where X update Y
and
Where a update b
and
Where 1 update 2
and
Where 3 update 4
and
Whe...
Hello all
I'm trying to search for '[EN]' in the string 'Nationality [EN] [ESP]', I want to remove this from the string so I'm using a replace method, code examaple below
var str = 'Nationality [EN] [ESP]';
var find = "[EN]";
var regex = new RegExp(find, "g");
alert(str.replace(regex, ''));
Since [EN] is identified as a character set...
I'm trying to use the Search command in Vim:
:Rs/F/T/X
R = range
F = text to find
T = text to replace with
X = options
But, when I want to search for the "." (dot character) I'm getting some problems.
The task: Replace all occurences of " ." (space dot) for ">" (greater-than)
So, first I tried this:
:%s/ ./>/g
But this changed m...
I have a hierarchy of directories containing many text files. I would like to search for a particular text string every time it comes up in one of the files, and replace it with another string. For example, I may want to replace every occurrence of the string "Coke" with "Pepsi". Does anyone know how to do this? I am wondering if there i...
I frequently edit files that have numerous inlineshapes, one per paragraph. One of the edits I make is to eliminate "double" paragraph marks either using Search and Replace or a simple macro that performs the same operation (e.g., search for "^p^p" and replace with "^p"). This operation works fine in Word 97-2003 documents (.doc), but ...
I have string in the following format:
blah IIF((doc.PostTypeId == 1), (Parse(doc.Id) > 1000), (doc.ParentId > 1000)) blah
and I want to convert it to:
blah (doc.PostTypeId == 1 ? Parse(doc.Id) > 1000 : doc.ParentId > 1000) blah
So far I'm using the following regex string for the match
IIF\((?<one>[^,]*?),\ (?<two>[^,]*?),\ (?<three...