MARCEDIT-L Archives

May 2015

MARCEDIT-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Gemma Larcina <[log in to unmask]>
Reply To:
MarcEdit support in technical and instructional matters <[log in to unmask]>
Date:
Fri, 29 May 2015 13:14:07 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (282 lines)
Thank you Geoff,

I will look into that!

Gemma

Gemma Larcina
Digital Assets Technician
Library & Learning Services 
Sheridan College
7899 McLaughlin Road Brampton, Ontario L6Y 5H9
T: 905 459 7533 ext. 5587
[log in to unmask]


-----Original Message-----
From: MarcEdit support in technical and instructional matters [mailto:[log in to unmask]] On Behalf Of MARCEDIT-L automatic digest system
Sent: May-29-15 12:00 AM
To: [log in to unmask]
Subject: MARCEDIT-L Digest - 27 May 2015 to 28 May 2015 (#2015-8)

There are 2 messages totalling 6525 lines in this issue.

Topics of the day:

  1. 008s--Date 1 from field 362
  2. Conditional find and replace

________________________________________________________________________

This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit.  If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]

----------------------------------------------------------------------

Date:    Wed, 27 May 2015 22:32:47 -0400
From:    Geoff Sinclair <[log in to unmask]>
Subject: Re: 008s--Date 1 from field 362

Hi Gemma,

You could try this, but it's not foolproof...

Copy the data from 362$a to a temporary field using Swap Field Utility (I'm using 999$a, but you can use any field that's not in use):
[image: Inline images 1]

Modify the temporary field. Search for a sequence of four digits starting with 19 or 20 (assumes your dates are from the present or previous century) and replace the 999$a with that:
[image: Inline images 8]
Regular expression .*(19|20)(\d\d).*

To be safe, look for 999 fields that don't contain exactly 4 digits using a few regular expressions:
[image: Inline images 9]
Regular expression to find non-digits: =999.*\$a.*\D Regular expression to find more than four characters: =999.*\$a.{5} Regular expression to find fewer than four characters: =999.*\$a.{0,3}$

Copy the 999$a to 008 using Swap Field Utility:
[image: Inline images 6]
This appends the date to the end of the 008 (positions 35-38, technically not legal...)

Use the regular Find/Replace to move this to 008/07-10:
[image: Inline images 7]
Regular expression (=008  .{7}).{4}(.{29})(.{4}) Replacement expression $1$3$2

BUT...this has the potential to give the wrong year if you have data with year-like sequences (e.g., vol. 1952)

Hope that helps!

--
Geoff Sinclair
cell: 705-477-7281

On 27 May 2015 at 14:50, Terry Reese <[log in to unmask]> wrote:

> If it was just date data – yes.  But since the 362 is fairly variable 
> field – probably not.  If you data was clean, and looked like this:
>
> =362  0\$a1990.
>
>
>
> Then you could use the Edit Subfield tools move function or swap field 
> function like the below.  Otherwise, I don’t think so because you’d 
> have to normalize the data as part of the process.
>
>
>
> Edit Subfield Function:
>
>
>
>
>
> Swap Field Function:
>
>
>
>
>
> --tr
>
>
>
>
>
> *From:* MarcEdit support in technical and instructional matters [mailto:
> [log in to unmask]] *On Behalf Of *Gemma Larcina
> *Sent:* Wednesday, May 27, 2015 9:17 AM
> *To:* [log in to unmask]
> *Subject:* [MARCEDIT-L] 008s--Date 1 from field 362
>
>
>
> Hello,
>
>
>
> We are working on constructing our own records from data in title 
> lists. I am wondering if there is a way to grab the date in field 362 
> and insert it into field 008 positions 07-10. I am not well-versed in 
> regular expressions, so I don’t know how I would go about trying this 
> out…
>
>
>
> Thank you,
>
>
>
> Gemma
>
>
>
> *Gemma Larcina <https://twitter.com/glarcina>*
>
> Digital Assets Technician
>
> Library & Learning Services
>
> Sheridan College
>
> 7899 McLaughlin Road Brampton, Ontario L6Y 5H9
>
> *T*: 905 459 7533 *ext.* *5587*
>
> *[log in to unmask]
> <[log in to unmask]" target="_blank">http:[log in to unmask]>*
>
>
>
>
>
> ______________________________________________________________________
> __
>
> This message comes to you via MARCEDIT-L, a Listserv(R) list for 
> technical and instructional support in MarcEdit. If you wish to 
> communicate directly with the list owners, write to 
> [log in to unmask] To unsubscribe, send a message 
> "SIGNOFF MARCEDIT-L" to [log in to unmask]
> ______________________________________________________________________
> __
>
> This message comes to you via MARCEDIT-L, a Listserv(R) list for 
> technical and instructional support in MarcEdit. If you wish to 
> communicate directly with the list owners, write to 
> [log in to unmask] To unsubscribe, send a message 
> "SIGNOFF MARCEDIT-L" to [log in to unmask]
>

________________________________________________________________________

This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit.  If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]

------------------------------

Date:    Wed, 27 May 2015 19:42:22 -0400
From:    Geoff Sinclair <[log in to unmask]>
Subject: Re: Conditional find and replace

Sorry Nick,

I should have used Leader/06 in my example, not 006/00. Here's the revised
script:

use strict;
use MARC::Batch;

my $filename = "test.mrc";
my $newfile = $filename . "MODIFIED952.mrc"; my $BATCH = MARC::Batch->new('USMARC', $filename ); my ($recCtr, $title);

open(OUTPUT, "> $newfile") or die $!;

while ( my $record = $BATCH->next() ) {
$recCtr++;
 my $t952 = $record->field('952');
my $old_952o = $t952->subfield('o');
my $leader = $record->leader();
my $type_of_record = substr($leader,6,1);  if ($type_of_record eq 'a') { # Language material $t952->update( o => "New value $recCtr (was $old_952o)" ); } elsif ($type_of_record eq 'c') { # Notated music $t952->update( o => "New musical value $recCtr (was $old_952o)" ); } else { # Notated music warn "Record $recCtr not modified.\n"; }  print OUTPUT $record->as_usmarc(); }



--
Geoff Sinclair
cell: 705-477-7281

On 27 May 2015 at 14:25, Geoff Sinclair <[log in to unmask]> wrote:

> Hi Nick,
>
> You could do it with Perl:
>
>
> use strict;
> use MARC::Batch;
>
> my $filename = "test.mrc";
> my $newfile = $filename . "MODIFIED952.mrc"; my $BATCH = 
> MARC::Batch->new('USMARC', $filename ); my ($recCtr, $title);
>
> open(OUTPUT, "> $newfile") or die $!;
>
> while ( my $record = $BATCH->next() ) { $recCtr++;  my $t006 = 
> $record->field('006'); my $t952 = $record->field('952'); my $old_952o 
> = $t952->subfield('o'); my $form_of_material = 
> substr($t006->as_string,0,1);  if ($form_of_material eq 'a') { # 
> Language material $t952->update( o => "New value $recCtr (was 
> $old_952o)" ); } elsif ($form_of_material eq 'c') { # Notated music 
> $t952->update( o => "New musical value $recCtr (was $old_952o)" ); } 
> else { # Notated music warn "Record $recCtr not modified.\n"; }  print 
> OUTPUT $record->as_usmarc(); }
>
> This script would break if there was no 952 or no 006, so you'd need 
> to add those checks in.
>
> --
> Geoff Sinclair
> cell: 705-477-7281
>
> On 27 May 2015 at 12:19, Nick Berezovsky <[log in to unmask]> wrote:
>
>> Are conditional find and replace expressions possible in MarcEdit?
>>
>> I need to modify a subfield (=952$o) depending on the type of record 
>> (position 06, leader)
>>
>> Apologies if this was discussed before.
>>
>> Thank you!
>>
>> Nick Berezovsky
>>
>> Head of Acquisitions and Cataloging
>> Salina Public Library,
>> 301 W. Elm St.
>> Salina, KS 67401
>>
>> [log in to unmask]
>> 785-825-4624
>>  
>> _____________________________________________________________________
>> ___
>>
>> This message comes to you via MARCEDIT-L, a Listserv(R) list for 
>> technical and instructional support in MarcEdit. If you wish to 
>> communicate directly with the list owners, write to 
>> [log in to unmask] To unsubscribe, send a message 
>> "SIGNOFF MARCEDIT-L" to [log in to unmask]
>>
>
>

________________________________________________________________________

This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit.  If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]

------------------------------

End of MARCEDIT-L Digest - 27 May 2015 to 28 May 2015 (#2015-8)
***************************************************************

________________________________________________________________________

This message comes to you via MARCEDIT-L, a Listserv(R) list for technical and instructional support in MarcEdit.  If you wish to communicate directly with the list owners, write to [log in to unmask] To unsubscribe, send a message "SIGNOFF MARCEDIT-L" to [log in to unmask]

ATOM RSS1 RSS2