Results 1 to 2 of 2

Thread: Find and Replace in All Files

  1. #1
    Associate
    Join Date
    Nov 2004
    Location
    New Jersey
    Posts
    13

    Find and Replace in All Files

    The command to do a global string replace in many files using find and ex.

    find . -name '*.html' -exec ex -s -c '%s/sql-ledger.png/mylogo.gif/g' -c 'w!' -c 'q' {} \;

    This worked great. I figured I'd post it here first. If this forum works out, "we" could make a nice knowledge base article out of the best ones

  2. #2
    Advisor
    Join Date
    Apr 2004
    Location
    orlando
    Posts
    608
    or using sed

    Code:
    find . -regex .*[.]html | xargs sed 's/sql-ledger.png/mylogo.gif/g' -i

Similar Threads

  1. List of fixes included in Windows XP SP2
    By regix in forum Windows - General Topics
    Replies: 6
    Last Post: 01-03-2005, 11:44 PM
  2. PHP on IIS Server
    By genesis in forum Windows - General Topics
    Replies: 8
    Last Post: 01-03-2005, 12:22 PM
  3. Where to find emerge?
    By Tyr_7BE in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 11-30-2002, 09:44 PM
  4. Replies: 8
    Last Post: 06-04-2002, 02:31 AM

Bookmarks

Posting Permissions

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