P
pauliecat
having all sorts of problems extracting the data. The file I am
extracting on is library catalog records. For instance sometimes I get
the subject printing in the wrong record, or blank lines between each
subject (some records have more than one subject field)
eg: Author Joe Blow
Title Fishing in a coal mine
SUBJ Fishing
SUBJ Coal mines
I'll get results like this
Author Joe Blow
Title Fishing in a coal mine
SUBJ Fishing
SUBJ Coal mines
I'd like to be able for instance keep things together and then have a
blank line between the last element of the first record and a space
between the start of the next record: Here is the script
my $title;
my $author;
my $call;
my $subj;
for my $line (@lines)
{
$line =~ /TITLE/ and $title = $line;
$line =~ /AUTHOR/ and $author = $line;
$line =~ /CALL/ and $call = $line;
$line =~ /SUBJ/ and $subj = $line;
#$line =~ /did not find/ and print $title,$line,"\n";
$line =~ /PUB/ and print $title,$author,$call,$subj,$line,"\n";
}
extracting on is library catalog records. For instance sometimes I get
the subject printing in the wrong record, or blank lines between each
subject (some records have more than one subject field)
eg: Author Joe Blow
Title Fishing in a coal mine
SUBJ Fishing
SUBJ Coal mines
I'll get results like this
Author Joe Blow
Title Fishing in a coal mine
SUBJ Fishing
SUBJ Coal mines
I'd like to be able for instance keep things together and then have a
blank line between the last element of the first record and a space
between the start of the next record: Here is the script
my $title;
my $author;
my $call;
my $subj;
for my $line (@lines)
{
$line =~ /TITLE/ and $title = $line;
$line =~ /AUTHOR/ and $author = $line;
$line =~ /CALL/ and $call = $line;
$line =~ /SUBJ/ and $subj = $line;
#$line =~ /did not find/ and print $title,$line,"\n";
$line =~ /PUB/ and print $title,$author,$call,$subj,$line,"\n";
}