in reply to cvs log parsing (REGEX)
#!/usr/bin/perl -wT use strict; my $commentsep = '-' x 28; my $recordsep = '=' x 77; { local $/ = $recordsep; # slurp everything up to the record sepera +tor for my $record (<DATA>) { my @arr = split(/$commentsep/,$record); # split on the comment sep +arator if (@arr > 1) { # if we have at least one +comment $arr[-1] = ''; # remove the last one $arr[-2] .= "$recordsep"; } print join($commentsep,@arr); } } __DATA__ RCS file: /cvsroot/work/bar.txt Working file: work/bar.txt head: 1.1 branch: locks: strict access list: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------- revision 1.1 date: 2001/08/23 00:19:47; author: joe; state: dead; branches: 1.1.2; file bar.txt was initially added on branch main. ---------------------------- revision 1.1.2.1 date: 2001/08/23 00:19:47; author: joe; state: Exp; lines: +3 -0 adding some stuff to the document ====================================================================== +======= RCS file: /cvsroot/work/foo.txt Working file: work/foo.txt head: 1.1 branch: locks: strict access list: keyword substitution: kv total revisions: 2; selected revisions: 2 description: ---------------------------- revision 1.1 date: 2001/08/23 00:19:47; author: joe; state: dead; branches: 1.1.2; file foo.txt was initially added on branch main. ---------------------------- revision 1.1.2.1 date: 2001/08/23 00:19:47; author: joe; state: Exp; lines: +3 -0 adding new text to my first file ====================================================================== +=======
-Blake
|
|---|