marc21 1019 B

123456789101112131415161718192021222324252627282930
  1. #--------------------------------------------
  2. # marc21: file(1) magic for MARC 21 Format
  3. #
  4. # Kevin Ford (kefo@loc.gov)
  5. #
  6. # MARC21 formats are for the representation and communication
  7. # of bibliographic and related information in machine-readable
  8. # form. For more info, see https://www.loc.gov/marc/
  9. # leader position 20-21 must be 45
  10. # and 22-23 also 00 so far, but we check that later.
  11. 20 string 45
  12. >0 search/2048 \x1e
  13. # leader starts with 5 digits, followed by codes specific to MARC format
  14. >>0 regex/1l (^[0-9]{5})[acdnp][^bhlnqsu-z] MARC21 Bibliographic
  15. !:mime application/marc
  16. >>0 regex/1l (^[0-9]{5})[acdnosx][z] MARC21 Authority
  17. !:mime application/marc
  18. >>0 regex/1l (^[0-9]{5})[cdn][uvxy] MARC21 Holdings
  19. !:mime application/marc
  20. >>0 regex/1l (^[0-9]{5})[acdn][w] MARC21 Classification
  21. !:mime application/marc
  22. >>0 regex/1l (^[0-9]{5})[cdn][q] MARC21 Community
  23. !:mime application/marc
  24. # leader position 22-23, should be "00" but is it?
  25. >>0 regex/1l (^.{21})([^0]{2}) (non-conforming)
  26. !:mime application/marc