Using ed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Using ed
# 1  
Old 10-29-2001
Question Using ed

If I use the diff -e command and save the results into a file. How do I use the file to make the changes on the file?

eg.
If I have two files AFile and BFile. If I use

diff -e AFile BFile > resultFile

This will store the results in resultFile. How do I then use the ed command to make the files the same?

Please help!
# 2  
Old 10-29-2001
Use the 'patch' program.

Example: patch < resultFile

That will search for the appropriate file to patch in your current directory and apply the changes if possible. I always prefer to use the unified diff format as I find it much easier to read if I need to examine a patch before applying it. Unified format diffs are based on context so they can be applied even if your source file has other (unrelated) changes. Just use the '-u' option to diff instead of '-e'.

Check the patch and diff man pages for more info.
# 3  
Old 10-29-2001
Excellent, I will have a go. Cheers
 
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question