Based on https://www.oclc.org/batchload/controlnumber.en.html, this ruby
function should get the job done:
def oclc_normalize oclc
oclc_num = oclc.gsub(/\D/, '').to_i.to_s
case oclc_num.length
when 1..8
"ocm" + "%08d" % oclc_num
when 9
"ocn" + oclc_num
else
"on" + oclc_num
Publishing the algorithm would be useful, so we can do checking /
normalisation in the Wikipedia authority control scripts (in Lua).
Cheers
Stuart
On Saturday, September 5, 2015, Tom Misilo wrote:
> Hi,
>
> I was wondering if anyone knows of any scripts that would convert
>
Hi,
I was wondering if anyone knows of any scripts that would convert
(OCoLC)3851870 to ocm0385170 for all the different ocm, ocn, ... combinations.
I am trying to clean up some of our data that had an internal ID in the 001 and
want to put the 035$a value into the 001.
Thanks,
Tom