Skip to main content
formatting
Source Link
perror
  • 3.3k
  • 7
  • 35
  • 45

When I use diff -y to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diff does make the text wrap, but there is no text wrapping with diff -y.

So how can I use diff -y with text wrapping?

I'm using the terminal on a Mac, if that helps.

This seems like a simple thing to want, but after searching everywhere I cannot find a solution!

Thanks!

When I use diff -y to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diff does make the text wrap, but there is no text wrapping with diff -y.

So how can I use diff -y with text wrapping?

I'm using the terminal on a Mac, if that helps.

This seems like a simple thing to want, but after searching everywhere I cannot find a solution!

Thanks!

When I use diff -y to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diff does make the text wrap, but there is no text wrapping with diff -y.

So how can I use diff -y with text wrapping?

I'm using the terminal on a Mac, if that helps.

This seems like a simple thing to want, but after searching everywhere I cannot find a solution!

When I use "diff -y"diff -y to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffingdiffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W-W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diffdiff does make the text wrap, but there is no text wrapping with diff -ydiff -y.

So how can I use diff -ydiff -y with text wrapping?

I'm using the terminal on a Mac, if that helps. Thanks! 

This seems like a simple thing to want, but after searching everywhere I cannot find a solution!

Thanks!

When I use "diff -y" to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diff does make the text wrap, but there is no text wrapping with diff -y.

So how can I use diff -y with text wrapping?

I'm using the terminal on a Mac, if that helps. Thanks! This seems like a simple thing to want, but after searching everywhere I cannot find a solution!

When I use diff -y to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diff does make the text wrap, but there is no text wrapping with diff -y.

So how can I use diff -y with text wrapping?

I'm using the terminal on a Mac, if that helps. 

This seems like a simple thing to want, but after searching everywhere I cannot find a solution!

Thanks!

Source Link
xenkan
  • 21
  • 1
  • 2

How to make text wrap with diff -y?

When I use "diff -y" to compare two text files with long lines of text, the result cuts off each column and I cannot read an entire line. I would like instead the text to wrap (or fold as it is also called) so that I can read the whole line.

For example, say I have two simple text files one line each:

cat tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is very long and will not show when I use a diff. 
The quick brown fox did not jump over the lazy dog. This line is very long and will not show when I use a diff. 

diffing them I get,

diff -y tmp.txt tmp2.txt
The quick brown fox jumped over the lazy dog. This line is ve | The quick brown fox did not jump over the lazy dog. This line

which cuts off the lines in the middle.

I know about the -W option to make it wider, but the lines are longer than my screen width so this does not help. Using a simple diff does make the text wrap, but there is no text wrapping with diff -y.

So how can I use diff -y with text wrapping?

I'm using the terminal on a Mac, if that helps. Thanks! This seems like a simple thing to want, but after searching everywhere I cannot find a solution!