Results 1 to 4 of 4
  1. #1

    search and replace command line

    need help with my command line skills.....

    i want to remove #!/usr/local/bin/php from my *.php files

    so far i have:

    find . -name "*.php" | xargs --replace {} sed 's/\#\!\/us\r/local\/bin\/php//g' > {}

    but it doesn't seem to work because its creating a file {}. Can someone help me out? Thanks!

  2. #2

    found the solution

    find . -name "*.php" | xargs sed -i 's/\#\!\/usr\/loca\/bin\/php//g'

  3. #3
    Join Date
    Jan 2005
    Jakarta, Indonesia


    Should be: find . -name "*.php" | xargs sed -i 's/\#\!\/usr\/local\/bin\/php//g'

  4. #4
    Join Date
    Nov 2005
    sed -i doesn't work in all Unixes...also you don't have to escape all that here's another much more compatible version:

    find . -name \*.php -print | xargs perl -pi.bak -e s',#!/usr/local/bin/php,,g'

    It'll keep you backup copies and is compatible with every flavor of Unix
    apex13 -
    stream13 - coming soon

Posting Permissions

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