Skip to content

Instantly share code, notes, and snippets.

@ruthtillman
Last active November 7, 2019 20:37
Show Gist options
  • Save ruthtillman/c183e0f87337ca0f30876d2a7bdce868 to your computer and use it in GitHub Desktop.
Save ruthtillman/c183e0f87337ca0f30876d2a7bdce868 to your computer and use it in GitHub Desktop.
Curling LCCNs to MARCXML

curl https://lccn.loc.gov/sh2018002914/marcxml -o sh2018002914.xml

Working from a simple list:

for lccn in nb2015017302 sh2018002914 n89223874; do curl https://lccn.loc.gov/$lccn/marcxml -o $lccn.xml; sleep 1; done

Separate the lccns with a single space. Added a second of sleep to avoid getting shut out.

If it gets longer, consider making a full bash script, as below:

#!/bin/bash
for lccn in nb2015017302 sh2018002914 n89223874 n82203435 sh85033801
do
  curl https://lccn.loc.gov/$lccn/marcxml -o $lccn.xml
  sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment