I have a huge cvs log file which, cleaned from the useless info, reads something like
Working file: unmodifiedfile1.c
================
Working file: modifiedfile1.h
----------------------------------
revision 1.3
Fixed some bug
================
Working file: unmodifiedfile2.h
================
Working file: modifiedfile2.h
----------------------------------
revision 1.1
Added some feature
================
Working file: unmodifiedfile3.h
I would like to clean the lines related to unmodified files:
Working file: modifiedfile1.h
----------------------------------
revision 1.3
Fixed some bug
================
Working file: modifiedfile2.h
----------------------------------
revision 1.1
Added some feature
================
The pattern to match is
Working file: FILENAME
================
What i've been able to do up to now is the following:
sed '/Working file:/ N ; s/\n/PLACEHOLDER/' changelog.txt |
grep -v 'PLACEHOLDER===' |
sed 's/PLACEHOLDER/\n/
I'm sure however there is a cleaner solution that my sed ignorance precludes me... ( also, a bonus would be being able to erase the very latest line if necessary)
P.S.
An output ending with:
================
Working file: unmodifiedfile3.h
is also acceptable