Tagged Questions
-2
votes
3answers
601 views
sed replace text - escape characters
I have a mysqldump file in which I want to replace the following text <a href="/tag/ with <a href="http://www.mydomain.com/tag/ but can't find a way to correctly escape all special characters.
...
1
vote
1answer
106 views
sed replace inside shell file
I have a shell file which needs to perform a replace of some text in a php file.
The line that needs replacing is:
$database = $db."_db";
The actual sed command needs to contain a variable so not ...
2
votes
5answers
159 views
Why isn't sed working?
I have a file that has a single line with a lot of ! characters. I want to remove all of the ! characters.
I tried this:
sed s/!// myfile
and this:
sed 's/!//' myfile
and this:
sed ...
0
votes
1answer
86 views
Sed Replace Help
I need some assistance with some sed replaces:
sed -ri 's#logging {
/* If you want to enable debugging, eg. using the 'rndc trace' command,
* named will try to write the 'named.run' file ...
1
vote
1answer
573 views
replace text in file without overwriting file
I want to use the command line to edit a text file but not overwrite it. I want to preserve the owner, group, and permissions of the file.
I have a file that holds a count of the number of times a ...
4
votes
2answers
222 views
Perl search & replace
How can I use search and replace to change the contents of a file.
I need to be able to change the 'all to none' and/or 'none to all' without having to manually do it every time for hundreds of ...
0
votes
5answers
2k views
How to recursively search and replace from command line on unix/linux system
So I want to change several files at one with one command. This is what I have so far:
find -regex ".*\.ext$" | xargs grep -l searchText 2> /dev/null | xargs -i sed 's/searchText/replaceText/' ...