Has anyone figured out the magic necessary for file to recognize MARC
If you don't know it, file is a Unix command that tells you what kind of
file a file is. For example:
$ file 101015_001.mp3
101015_001.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, Stereo
$ file P1000026.jpg
P1000026.jpg: JPEG image data, EXIF standard, comment: "AppleMark"
It's a really useful command. I assume it's on OSX, but I don't know.
You can get it for Windows with Cygwin.
The problem is, file doesn't grok MARC:
$ file catalog.01.mrc
I took a stab at getting the magic defined, but it didn't work. I'll
include what I used below. You can put it into a magic.txt file, and then
file -m magic.txt some_file.mrc
to test it. It'll tell you the file is MARC Bibliographic ... but it also
thinks that PDFs, JPEGs, and text files are MARC. That's no good.
It'd be great if the MARC magic got into the central magic database so
everyone would be able to recognize various MARC file types.
# --- clip'n'test
# MARC 21 for Bibliographic Data
# This doesn't work properly
0 string x
>5 regex [acdnp]
>6 regex [acdefgijkmoprt]
>7 regex [abcims]
>8 regex [\ a]
>9 regex [\ a]
>10 byte x
>11 byte x
>12 string x
>17 regex [\ 12345678uz]
>18 regex [\ aciu]
>19 regex [\ abc] MARC Bibliographic
#>20 byte 4
#>21 byte 5
#>22 byte 0
#>23 byte 0 MARC Bibliographic
# --- end clip'n'test
William Denton, Toronto : miskatonic.org www.frbr.org openfrbr.org