Reputation: 10302
I am redirecting the output of a cvs diff onto a log.txt file.
C:\Temp> cvs diff -b -B -r 1.5 -r 1.6 Project\src\Sample.java > log.txt
The generated content of the log.txt
file upon executing the above command is like this :
Index: project/src/Sample.java
===================================================================
RCS file: \repobase/src/Sample.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -r1.5 -r1.6
78a79,82
> public java.lang.Class getJavaClass() {
> return Sample.class;
> }
>
92c96
< return Demo.getparentClass(this.getClass());
---
> return MyClass.clazz;
All lines of this file that start with <
or >
are not necessary. I want to ignore all such lines only to push in the minimal rest into the log.txt
file. How can I do this via windows command line?
Upvotes: 0
Views: 2348
Reputation: 130839
Perhaps the cvs diff --brief option will give you what you want.
If not, then you can pipe the diff output to FINDSDTR and let it filter the lines
cvs diff -b -B -r 1.5 -r 1.6 Project\src\Sample.java | findstr /vbl "< >" > log.txt
/v option means print lines that don't contain any of the strings
/b option means match the search string starting at the beginning of each line
/l means literal search string (as opposed to a regular expression)
Search string is split at each space, so "< >" is really 2 search strings.
For more more help on FINDSTR use `FINDSTR /?'.
For additional help see What are the undocumented features and limitations of the Windows FINDSTR command?
Upvotes: 1