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. replace date using sed
    By svar in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 11-17-2010, 04:30 AM
  2. Replace text in multiple files
    By lemmas in forum Linux - General Topics
    Replies: 1
    Last Post: 03-15-2006, 04:47 PM
  3. Linux to replace Windows 2k domain server
    By iniva in forum Linux - Hardware, Networking & Security
    Replies: 0
    Last Post: 02-07-2005, 12:44 PM
  4. Distro to replace Suse for laptop.
    By gmoreno in forum Linux - Software, Applications & Programming
    Replies: 13
    Last Post: 03-10-2004, 01:15 AM
  5. replace win2k logon dialog?
    By cj171 in forum Windows - General Topics
    Replies: 3
    Last Post: 08-28-2003, 03:30 PM

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
  •