You can use diff -w or –ignore-all-space options to ignore all white space.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
## ignore all white space echo -e " hello\n world" > myfile1 ## create some files echo -e "hello\nworld " > myfile2 diff myfile1 myfile2 ## normal output ## returns ## 1,2c1,2 ## < hello ## < world ## --- ## > hello ## > world diff -b myfile1 myfile2 ## ignore changes in the amount of white space ## returns ## 1,2c1,2 ## < hello ## < world ## --- ## > hello ## > world diff -w myfile1 myfile2 ## ignore all white space ## returns nothing as all white space ignored rm -r my* |