Results 1 to 4 of 4
  1. #1
    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

  2. #2
    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' {} ";" -print
    Dan 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/

  3. #3
    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

  4. #4
    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

  1. Quick Question!!
    By TylerH in forum Hosting Security and Technology
    Replies: 6
    Last Post: 10-01-2008, 05:37 AM
  2. Quick SCp Question
    By saj in forum Hosting Security and Technology
    Replies: 1
    Last Post: 09-16-2006, 10:22 AM
  3. a quick question about php.ini
    By VapoRub in forum Hosting Security and Technology
    Replies: 5
    Last Post: 08-06-2004, 11:04 PM
  4. Quick VPS question
    By JP. in forum Dedicated Server
    Replies: 7
    Last Post: 02-13-2004, 12:32 AM
  5. One QUICK Question
    By BizzyD in forum Dedicated Server
    Replies: 9
    Last Post: 03-27-2003, 10:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •