Show entire lines with diff command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Show entire lines with diff command
# 1  
Old 01-06-2010
Show entire lines with diff command

Hi,

When I run the diff command using diff -yt file1 file2, I get the output in which original lines are truncated.

I tried using -W switch with diff. However, that does not produce exact output as I want. Is it possible to show entire line of file1 and file2 in diff command's output?

Thanks in advance.
# 2  
Old 01-06-2010
please provide the sample input files and expected output.
# 3  
Old 01-07-2010
file1:
This is the first sample line in my file1, I want to see full content in the diff result.
file2:
This is the first sample line in my file2, I want to see full content in the diff result.

Current Result:

Code:
diff -yt file1 file2
This is the first sample line in my file1, I want to see full c |  This is the first sample line in my file2, I want to see full c

In the side by side difference view, I want:
This is the first sample line in my file1, I want to see full content in the diff result. | This is the first sample line in my file2, I want to see full content in the diff result.
# 4  
Old 01-07-2010
You can use the -W or --width option. See the man page.
# 5  
Old 01-07-2010
As I mentioned, -W doesn't produce exact output as I want. I want to preserve the alignment of original file and hence, have to use -yt.
# 6  
Old 01-07-2010
I beg your pardon - I missed that in your original post.

Having said that, -W seems to give the desired output. What's wrong with the output of -W?
# 7  
Old 01-07-2010
If I provide -W 250, I understand both the file's content will be adjusted in width of 125 characters, correct me if I am wrong. and if that's correct, then what about the files that have longer than 125 characters?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Match pattern only between certain lines in entire file

Hello, I have input that looks like this: * 0 -1 103 0 0 m. 7 LineNr 23 ClauseNr 1: 1: 1: 304: 0 0 SentenceNr 13 TxtType: Q Pargr: 2.1 ClType:MSyn PS004,006 ZBX= 0 1 1 0 7 -1 -1 3 2 3 2 -1 1 1 -1 -1 -1 -1 0 501 0 PS004,006 ZBX ... (2 Replies)
Discussion started by: jvoot
2 Replies

2. Shell Programming and Scripting

Diff command file entries in different lines

Hello, I have two files to compare these contain some contents like this : FIle 1 : A B C E File 2 has some new entries and the old entries are in some different ordre File 2 could be like this : C E A B G I (4 Replies)
Discussion started by: ajayram
4 Replies

3. Shell Programming and Scripting

How to add two common lines on entire file

Hi Hi i have 500 lines of file,each line i need to add another two lines also need to separate with one line for every 3 lines after adding two lines.How to achieve this using shell? For example: Input file : dn: uid=apple,dc=example,dc=com dn: uid=ball,dc=example,dc=com output:... (4 Replies)
Discussion started by: buzzme
4 Replies

4. UNIX for Dummies Questions & Answers

[diff] hide missing rows, show similar

Hi all! Having the following two csv files: file1 AAA;0000;RED CCC;9900;GREEN file2 AAA;0000;BLACK BBB;0099;BLU What's the correct syntax to hide only the missing rows (BBB,CCC) and show the rows that differ only with last field? I expect something like this: diff <options> file1... (2 Replies)
Discussion started by: Evan
2 Replies

5. Shell Programming and Scripting

How to make diff show differences one line at a time and not group them?

Is there a way to tell diff to show differences one line at a time and not to group them? For example, I have two files: file1: line 1 line 2 line 3 diff line 4 diff line 5 diff line 6 line 7 file2: line 1 line 2 line 3 diff. line 4 diff. line 5 diff. line 6 line 7 (13 Replies)
Discussion started by: mmr11408
13 Replies

6. Shell Programming and Scripting

sed show lines text between 2 blank lines

I have a file like blah blah blah blah this is the text I need, which might be between 1-4 lines, but always has a blank line above and below it, and is at the end of the text file the code tags don't show the trailing blank line. I started by deleting the last blank line with: ... (2 Replies)
Discussion started by: unclecameron
2 Replies

7. Shell Programming and Scripting

Help in replacing two blank lines with two lines of diff data

Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script... I used sed to search a line and insert two blank lines after the searchd line using the following sed command. sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines..... (4 Replies)
Discussion started by: arjun_arippa
4 Replies

8. Shell Programming and Scripting

Show the diff in two files using awk

Hi, How can i use AWK or any other commands to find the difference between 2 files. File A aaa bbb ccc 111 222 File B aaa ccc 111 Output bbb 222 (6 Replies)
Discussion started by: gambit97
6 Replies

9. UNIX for Dummies Questions & Answers

Show the entire line using ps

Using the vanilla ps -ef I noticed that the CMD (or command) line gets cut off after 90 characters UID PID PPID C STIME TTY TIME CMD root 6020 3822 0 Jun 19 ? 0:01 ./webservd-wdog -r /export/opt/sows/61sp4 -d /export/opt/sows/61sp4/https-logse Googling... (4 Replies)
Discussion started by: SixSigma1978
4 Replies

10. Shell Programming and Scripting

Diff Command to return the number of lines inserted,deleted and changed.

Hello, I have to compare two files file1 and file2, retrieve the number of lines modified (added, deleted or modified) in file2. Output must be like: File2: Added Deleted Changed Total ------ ------- -------- ----- 2 1 1 4 Somebody... (2 Replies)
Discussion started by: nmattam
2 Replies
Login or Register to Ask a Question