Created
January 16, 2020 00:50
-
-
Save mjordan/16df0416a64ef95a527cb16e5d028cd5 to your computer and use it in GitHub Desktop.
Shell script to get all the Solr fields indexed from MODS elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SOLR_HOST='http://192.168.50.111:8080' | |
SOLR_URL="$SOLR_HOST/solr/select?q=*:*&wt=csv&rows=0&facet&fl=mods_*" | |
curl -s -o mods_elements.txt "$SOLR_URL" | |
sed 's/,/\n/g' mods_elements.txt > mods_elements_one_per_line.txt | |
sed 's/_mlt$// ; s/_ms$// ; s/_mt$// ; s/_s$// ; s/_ss$// ; s/_t$// ; s/_all$// ; s/_dt$// ; s/_mdt$//' mods_elements_one_per_line.txt > mods_elements_one_per_line.txt.pruned | |
sort mods_elements_one_per_line.txt.pruned > mods_elements_one_per_line.txt.pruned.sorted | |
uniq mods_elements_one_per_line.txt.pruned.sorted > mods_elements.txt | |
rm mods_elements_one_per_line.txt | |
rm mods_elements_one_per_line.txt.pruned | |
rm mods_elements_one_per_line.txt.pruned.sorted | |
echo "The list of all unique SOLR fields indexed from MODS elements (with _x variants removed) is in mods_elements.txt. Enjoy!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment