How to ignore comment changes and empty changes in two files?

I use the "svn diff" command to get changes at the directory level, but this diff includes all comment line changes and empty line changes. How to ignore these values?

Example:

diff file:

+ import......

+ some code
+ #comment
+ blank line
+ some code

this should be as follows: (comments and blank lines should be omitted)

+ import......

+ some code
+ some code

It would also be nice if I can process the first file using Java or unix and delete these empty lines and comment lines?

+3
source share
2 answers

svn diff -r 100:200 -x -b > file.diff

for spaces Use -x --ignore-space-changeor -x --ignore-all-space. (See svn -h diff.)

+1
source

, # , egrep ,

svn diff <args> | egrep -v '^\+(#|$)'

egrep?

egrep - grep, , grep egrep, grep , grep -E. . , -E , +,? | (). , , grep.

0

All Articles