You can use diff -I RE or –ignore-matching-lines=RE options to ignore changes where all lines match RE. Ignore changes that just insert or delete lines that match RE.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
## ignore changes where all lines match regular expression echo -e "hello\nworld" > myfile1 ## create some files echo -e "hello\nworld\nwelcome" > myfile2 diff myfile1 myfile2 ## all are compared ## returns ## 2a3 ## > welcome diff --ignore-matching-lines="welcome" myfile1 myfile2 ## welcome is ignored ## returns nothing as we excluded welcome rm -r my* |