The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep on multiple words to match text template rider29 Shell Programming and Scripting 6 05-23-2008 11:21 AM
Replace text in multiple files on9west Shell Programming and Scripting 1 05-20-2008 01:35 AM
Replace text in multiple files Tonka52 Shell Programming and Scripting 10 03-24-2008 08:11 AM
match field between 2 files phamp008 Shell Programming and Scripting 8 01-23-2008 07:46 AM
Search and replace multi-line text in files marz Shell Programming and Scripting 10 10-10-2005 08:05 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-16-2002
wilsonchan1000 wilsonchan1000 is offline
Registered User
  
 

Join Date: Sep 2001
Posts: 20
Replace text in match files

Hi all,

I want to replace text 'DEF' for those files containing text 'ABC'.

I can only locate the files containing text 'ABC', but I don't know how to replace the text 'ABC' with 'DEF'.

I use the following command to locate the files containing 'ABC'

find . -exec grep -l 'ABC' {} \;

But don't know how to replace it.

Thanks in advance.

Regards
Wilson
  #2 (permalink)  
Old 12-16-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
sed 's/ABC/DEF/g' < inputfile > tmpfile
mv tmpfile inputfile
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:13 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0