Author : tom jones
Number : abc123
Version Number : 17
Feature : nothing was changed
File Name : house.doc
Modification Date : 05/16/2002
Paragraph Number Requirement Number Last Modified
BCBLUE-BC-191.a SMAPSFS-VPU-1232 17
BCBLUE-BC-232.g SMAPSFS-VPU-2342 17
Author : fred jones
Number : abc124
Version Number : 18
Feature : nothing much was changed
File Name : house.doc
Modification Date : 05/18/2002
Paragraph Number Requirement Number Last Modified
BCBLUE-BC-191.a SMAPSFS-VPU-1232 18
BCBLUE-BC-232.g SMAPSFS-VPU-2342 18
####
use strict;
$/ = ""; # paragraph mode.
print "File Name,Author,Date (MM/DD/Year),TIME (H:M:S),Version No.,".
"Number,Feature Name,Paragraph Number,Requirement Number\n";
while(<>)
{
# $_ =~ Author : foo\nNumber : abc....
# These regexps may need changing if you allow
# other characters in them. You may find something
# more general such as what I use for Feature
# best for all fields...
my ($author) = m/^Author\s+:\s+([\w ]+)$/m;
my ($number) = m/^Number\s+:\s+([\w ]+)$/m;
my ($version) = m/Version Number\s+:\s+([\w ]+)$/m;
my ($feature) = m/Feature\s+:\s+([^\s].*)$/m;
my ($filename) = m/File Name\s+:\s+([\w._-]+)$/m;
my ($mod_date) = m!Modification Date\s+:\s+(\d{2}/\d{2}/\d{4})!m;
# Hope that Paragraph Number etc occurs at the end of the
# record.
my ($otherjunk) = m/Paragraph(.*)$/s;
my @paragraphs = (split /\n/, $otherjunk);
shift @paragraphs; # don't need headings;
foreach my $line (@paragraphs)
{
my ($para, $requirement) = split(/\s+/, $line);
print qq{"$filename","$author","$mod_date","","$version",}.
qq{"$number","$para","$requirement"\n};
}
}
##
##
File Name,Author,Date (MM/DD/Year),TIME (H:M:S),Version No.,Number,Feature Name,Paragraph Number,Requirement Number
"house.doc","tom jones","05/16/2002","","17","abc123","nothing was changed","BCBLUE-BC-191.a","SMAPSFS-VPU-1232"
"house.doc","tom jones","05/16/2002","","17","abc123","nothing was changed","BCBLUE-BC-232.g","SMAPSFS-VPU-2342"
"house.doc","fred jones","05/18/2002","","18","abc124","nothing much was changed","BCBLUE-BC-191.a","SMAPSFS-VPU-1232"
"house.doc","fred jones","05/18/2002","","18","abc124","nothing much was changed","BCBLUE-BC-232.g","SMAPSFS-VPU-2342"
##
##
while(<>)
{
if(/^Author\s+:\s+/)
{
print "\n";
}
print;
}