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
need help with post:extract multiple columns from multiple files manishabh Shell Programming and Scripting 0 08-19-2009 01:09 PM
extract multiple cloumns from multiple files; skip rows and include filenames; awk manishabh Shell Programming and Scripting 4 08-18-2009 10:55 PM
Multiple search string in multiple files using awk pinnacle Shell Programming and Scripting 0 05-05-2009 12:08 PM
Combine multiple columns from multiple files martva Shell Programming and Scripting 5 12-02-2008 09:23 AM
Adding Multiple Lines to Multiple Files dayinthelife Shell Programming and Scripting 2 06-04-2008 11:50 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
mgrahamnz mgrahamnz is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 4
sed on multiple files?

Hi,

I want to do a search and replace on multiple text files. Can I use sed to do this?

i.e. I want to do something like:

Code:
$ sed *.html -e 's/<\/body>/<\!-- blah -->\n<\/body>/' | grep -1 body
... then pipe/ channel the results back into the same files that were searched.

how would one go about this last bit?

Regards, Maek
  #2 (permalink)  
Old 4 Weeks Ago
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,952
if you are looking for in-place edit and access to GNU sed is available
then try with sed -i
  #3 (permalink)  
Old 4 Weeks Ago
mgrahamnz mgrahamnz is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 4
That did the trick - thank-you very much.

Regards, Mark
Reply

Bookmarks

Tags
multiple files, search and replace, sed

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 08:50 AM.


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