![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need help in diff command : | ali560045 | Shell Programming and Scripting | 5 | 05-26-2008 06:22 AM |
| diff command | Vichu | Shell Programming and Scripting | 1 | 04-28-2008 04:06 AM |
| Need help with Scripting diff command | tlfletcher05 | Shell Programming and Scripting | 2 | 01-25-2008 11:19 PM |
| difference between AIX shell scripting and Unix shell scripting. | haroonec | Shell Programming and Scripting | 2 | 04-12-2006 05:12 AM |
| diff command | gilead29 | UNIX for Dummies Questions & Answers | 7 | 03-09-2004 06:12 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
shell scripting my own diff command
Hi I would like to run the diff command and recieve a little different output. I am on a linux machine. I am pretty new to shell scripting. So far my idea has shaped up to this, unworking, script. I would like file1: and file2: instead of the usual > or < output you recieve,
diff | sed -e s/^<*/file1:/g s/^>*/file2:/g d/---/g Can anyone help me shape this into a working script?
__________________
-garrett garrett63@msn.com |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Give this a try:
diff file1 file2 | sed -e 's/^</file1:/g' -e 's/^>/file2:/g' |
|
#3
|
|||
|
|||
|
I am writing this to use as a shell script, that I can run on multiple files by typing just: mydiff firstfile secondfile
I have been working and have this code: diff $1 $2 | sed -e 's/^<*/file1:/g' -e 's/^>*/file2:/g' I type: mydiff firstfile secondfile It is running the diff but output comes out like this: file2:file1:> file2:file1:> file2:file1:> file2:file1:> Thanks for the reply
__________________
-garrett garrett63@msn.com |
|
#4
|
|||
|
|||
|
oombera's reply works all you have to do is replace diff file1 file2 w/ diff $1 $2 and it works from a shell script.
|
|
#5
|
|||
|
|||
|
Thanks for the replies I had it working in my second post, I was just confused by the output. It is working smoothly now. Thanks eveyone
__________________
-garrett garrett63@msn.com |
|||
| Google The UNIX and Linux Forums |