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. Squid : Multiple access log files (ACL Wise)
    By Suhas! in forum Redhat / Fedora
    Replies: 0
    Last Post: 09-24-2007, 05:43 AM
  2. Creating Visio Drawings from Text Files
    By The Donald in forum Windows - General Topics
    Replies: 0
    Last Post: 01-05-2005, 06:24 AM
  3. Device Manager Error Codes
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-05-2005, 12:52 AM
  4. Files and Settings Transfer Wizard
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 12-31-2004, 10:12 PM
  5. Find and Replace in All Files
    By rhoobler in forum Linux - General Topics
    Replies: 1
    Last Post: 11-21-2004, 10:06 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
  •