Results 1 to 4 of 4
-
07-05-2009, 10:17 PM #1Junior Guru Wannabe
- Join Date
- May 2008
- Posts
- 78
sed commands have a quick question
im doing a find and replace command in putty
find . -type f -name '*' -exec sed -i 's/2356417941616722/9653796027255701/g' {} ";" -print
my question is how and i take my sed command line and make it
add a directory
example
find . -type f -name '*' -exec sed -i 's/xeleven59.com/xeleven59.com/vs/g' {} ";" -print
i cant seem to get it to add the /vs
second i want to run my sed command to add a space in a name such as
Free Online Ads but putty or unix does not seem to like spaces
find . -type f -name '*' -exec sed -i 's/Freebies/Free Online Ads/g' {} ';' -print
i just dont know what i have to do to add the special characters or space
thanks for looking
-
07-06-2009, 10:52 AM #2Junior Guru Wannabe
- Join Date
- May 2008
- Posts
- 43
backslash should escape the forward slash (or any other special char) in the replace string, so:
find . -type f -name '*' -exec sed -i 's/xeleven59.com/xeleven59.com\/vs/g' {} ";" -printDan Hildebrandt, Developer / Support, WebGroup Media LLC. - http://twitter.com/cerb5
Cerberus Helpdesk 5.x is a CRM toolkit. Remember anything about anybody, swiftly reply to a flood of e-mail,
capture feedback organically, track time, flag opportunities, share tasks, and more. http://www.cerberusweb.com/
-
07-06-2009, 04:21 PM #3Junior Guru Wannabe
- Join Date
- May 2008
- Posts
- 78
Thanks i thought it was something like that just wanted to make sure before i ran a command.
How about for a space i wanted to run a command
find . -type f -name '*' -exec sed -i 's/Freebies/Free Online Ads/g' {} ';' -print
what do you put in there for a empty space, i know putty is very funny about empty spaces.
Thanks
-
07-09-2009, 03:50 PM #4Junior Guru Wannabe
- Join Date
- May 2008
- Posts
- 78
SED COMMAND BLOOPER 101
find . -type f -name '*' -exec sed -i 's/?page=1/page1.html/g' {} ";" -print
did great changed all the ?page=1 to page1.html i was like ohhh yeah i got this :p well then i saw a wierd piece of code page1.html0 what the heck is this, its suppose to be page10.html so my sed command went over board on its serach and replace
So what did i do wrong it did this from 10 to 19
page1.html0
page1.html1
page1.html2
etc
so whats a sed command i can use to only change the ?page=1 to page1.html with out it doing the others ?
And if i use the same sed command to change the page1.html0 to page10.html
will it change all my page1.html also ?
Help Help
Similar Threads
-
Quick Question!!
By TylerH in forum Hosting Security and TechnologyReplies: 6Last Post: 10-01-2008, 05:37 AM -
Quick SCp Question
By saj in forum Hosting Security and TechnologyReplies: 1Last Post: 09-16-2006, 10:22 AM -
a quick question about php.ini
By VapoRub in forum Hosting Security and TechnologyReplies: 5Last Post: 08-06-2004, 11:04 PM -
Quick VPS question
By JP. in forum Dedicated ServerReplies: 7Last Post: 02-13-2004, 12:32 AM -
One QUICK Question
By BizzyD in forum Dedicated ServerReplies: 9Last Post: 03-27-2003, 10:00 PM