You can use diff -t or –expand-tabs options to expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
## Display tabs to spaces in the output echo -e "1\t2\n3\n4" > myfile1 ## create some files echo -e "1 2\n5\n4" > myfile2 diff -t myfile1 myfile2 ## expands tab in space ## returns ## 1,2c1,2 ## < 1 2 ## < 3 ## --- ## > 1 2 ## > 5 diff myfile1 myfile2 ## output without -t option ## returns ## 1,2c1,2 ## < 1 2 ## < 3 ## --- ## > 1 2 ## > 5 |