Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 26th July 2007, 21:51
tiffany C tiffany C is offline
Junior Member
 
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to add/change entries use diff and sed

Hi,

I am new on linux bash script. I am asking to do a "diff" on 2 files and then add/change file1 based on the comparsion with file2. I knew I have to use "diff" and "sed" to do it, but I have no idea how to put them together. Anybody has any idea? What is the regular expression should i use for sed.

Thanks,
Tiffany
Reply With Quote
Sponsored Links
  #2  
Old 1st August 2007, 03:32
cfajohnson cfajohnson is offline
Junior Member
 
Join Date: Apr 2007
Location: Toronto, Canada
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by tiffany C
I am new on linux bash script. I am asking to do a "diff" on 2 files and then add/change file1 based on the comparsion with file2. I knew I have to use "diff" and "sed" to do it, but I have no idea how to put them together. Anybody has any idea? What is the regular expression should i use for sed.
Use patch, not sed.

However, if you just want file1 to be the same as file2, why not copy file2 to file1?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

Forum Jump


All times are GMT +2. The time now is 18:17.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.