www.webdeveloper.com
Results 1 to 4 of 4

Thread: Unix all file replace

  1. #1
    Join Date
    Apr 2006
    Posts
    59

    Unix all file replace

    I hope i've started this in the correct thread.. anyways..

    I am trying to do a text replace in unix to all files in a directory

    I've tried this

    sed -e 's/include\(\"connect/bob' -i *.php

    however it gives an error
    Code:
    sed: -e expression #1, char 24: unterminated `s' command
    I'm sure it has to do with the \(\" part..

    Basically i want to replace all include("connect with bob...

    And there are too many files to do it manually...

    I have no experience with unix.. but i heard i can also use GREP?

    Any help would be appreciated.

  2. #2
    Join Date
    May 2003
    Location
    Milwaukee
    Posts
    342
    There's a product named UltraEdit that you can download as a trial. It has a built-in "search and replace in files" function.

  3. #3
    Join Date
    Apr 2006
    Posts
    59
    For those interested, i found the solution.

    I was missing a / at the end

    So it should be
    sed -e 's/include\(\"connect/bob/' -i *.php

  4. #4
    Join Date
    May 2003
    Location
    Milwaukee
    Posts
    342
    Glad you got it to work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles