Results 1 to 8 of 8
I have wriiten a bash script for comparing 2 files using diff and enscipt. The output is to be shown side-by-side without showing the common portion in the second file. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-16-2005 #1Just Joined!
- Join Date
- Dec 2005
- Posts
- 4
Comparing file side by side
I have wriiten a bash script for comparing 2 files using diff and enscipt. The output is to be shown side-by-side without showing the common portion in the second file. The problem is some lines of the second file is getting wrapped and it appears as part of the first file. Is there any way out to align the wrapped text along with the second file? Thanks.
Commands used within the bash script are
diff --side-by-side -y -t --width=300 file1 file2 > outfile
enscript -p psfilename --margins=1:1:1:1 -r -fCourier7 --word-wrap outfile
- 12-16-2005 #2
Why not just use the comm utility with the -3 option, which supresses lines that are common to each file?
- 12-16-2005 #3Just Joined!
- Join Date
- Dec 2005
- Posts
- 4
thanks, but my requirement is to take a print of that and review. So, i cannot supress common lines. My output is fine, only problem is that some of the lines that are not common, and is part of the second file is getting wrapped and it goes as part of the first file. I require that to appear along with the second file as it should be. please advice.
- 12-16-2005 #4
I really don't understand you.
- 12-16-2005 #5Just Joined!
- Join Date
- Dec 2005
- Posts
- 4
sample output of my script
current output (here the 'in java' is getting wrapped and comes as as part of the first file)
===============================================
This is a sample program (
comparing two files in perl < comparing two file
in java
Test completed (
Expected output('in java' should be part of the second file)
===============================================
This is a sample program (
comparing two files in perl < comparing two files in java
Test completed (
- 12-16-2005 #6Just Joined!
- Join Date
- Apr 2005
- Posts
- 23
doesnt enscript allow you to specify a two column format? if so, try writing one file to one coloman and the other file to the other column.
- 12-16-2005 #7Just Joined!
- Join Date
- Dec 2005
- Posts
- 4
enscript has 2 columns option, but how will it consider the output from diff as 2 different files. And if thru enscript i am able to show the 2 actual files in 2 different columns, then how would i see the differences between these 2 files?
- 12-19-2005 #8Just Joined!
- Join Date
- Apr 2005
- Posts
- 23
I think you're just going to have to capture the output and manually format it. If text is wrapped, you'll have to add the correct number of spaces to the new line.


Reply With Quote
