Results 1 to 2 of 2

Thread: Replace text in multiple files

  1. #1

    Question Replace text in multiple files

    Is there a command or two that will replace a string with another string in multiple files at once? I need to change the same text string in a bunch of html files. If I can do it with one or two commands that would be sweet.

    Thanks,
    Nick

  2. #2
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811
    for file in 'ls *.html'; do cat $file |sed 's/some text/some new text/g'>$file.new done
    Don't worry Ma'am. We're university students, - We know what We're doing.
    'Ruiat coelum, fiat voluntas tua.'
    Datalogi - en livsstil; Intet liv, ingen stil.

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. Squid : Multiple access log files (ACL Wise)
    By Suhas! in forum Redhat / Fedora
    Replies: 0
    Last Post: 09-24-2007, 05:43 AM
  3. Creating Visio Drawings from Text Files
    By The Donald in forum Windows - General Topics
    Replies: 0
    Last Post: 01-05-2005, 07:24 AM
  4. Find and Replace in All Files
    By rhoobler in forum Linux - General Topics
    Replies: 1
    Last Post: 11-21-2004, 11:06 PM
  5. Distro to replace Suse for laptop.
    By gmoreno in forum Linux - Software, Applications & Programming
    Replies: 13
    Last Post: 03-10-2004, 01:15 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
  •