3

I am using "svn diff" command to get changes at directory level but this diff include all the comment line changes and blank line changes. How can I ignore these values?

ex:

diff file:

+ import......

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

this should be as below:(comments and blank lines should be ommitted)

+ import......

+ some code
+ some code

It would be good also if i can process the first file using Java or unix and delete these blank and comment lines?

Developer
  • 81
  • 7

2 Answers2

1

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

for whitespaces Use -x --ignore-space-change or -x --ignore-all-space. (See svn -h diff.)

Harshal Doshi Jain
  • 2,567
  • 1
  • 20
  • 16
0

Presuming that the # is your comment character, then you can use egrep command to filter out the lines you don't want

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

What is egrep ?

The egrep command is shortcut for grep binary, but with one exception, when grep is invoked as egrep the grep binary activates its internal logic as it would be called as grep -E. What the difference you will ask.. and the difference is that -E parameter enables usage of extended regexp patterns, it will allow you using of such meta-symbols as +, ? or | (pipe). They aren't ordinal characters like we used to have in words or filenames but control commands for grep binary itself.

Harshal Doshi Jain
  • 2,567
  • 1
  • 20
  • 16
Beano
  • 7,551
  • 3
  • 24
  • 27