tags:

views:

47

answers:

3

Hello I am trying to get the difference between to text files. There are a lot of differences and viewing them in terminal is making it volatile since I cannot save them. I want to view and save the diff. How would I catch the output and print it to a text file??

Code I am using for getting the diff is diff -i -w -B file1.txt file2.txt

+3  A: 

Just redirect it to a file:

 diff -i -w -B file1.txt file2.txt > output.diff

If you'd like to know more about redirecting output, the advanced details vary shell-to-shell, but here's a reference for bash and a cheat-sheet for the common stdout/stderr redirects.

Jefromi
+5  A: 
vlad b.
+1  A: 

Save to text file:

diff -i -w -B file1.txt file2.txt > diff.txt

Write directly to printer:

diff -i -w -B file1.txt file2.txt | lpr

Write saved text file to printer

lpr diff.txt

'Hope that helps .. PSM

PS: Here's a link on Linux command-line printing:

http://tldp.org/HOWTO/Printing-Usage-HOWTO-2.html

you are the man!!
sai