Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ia upload script for EPOCH toy instruction manuals
echo "identifier,file,description,subject,title,creator,mediatype,language" > epoch.csv
for file in *.pdf
do
# echo "Processing: $file"
id=`echo $file | awk '{print substr($0,1,5);exit}'`
en=`cat en.txt | grep $id`
trimmed_en=`echo "${en:8}"`
ja=`cat ja.txt | grep $id`
trimmed_ja=`echo "${ja:7}"`
prefix="epoch-manual-"
identifier=`echo "${trimmed_en//[()!\':+]/}"`
identifier=`echo "${identifier//&/and}"`
identifier=`echo "${identifier//\./ }"`
identifier=`echo "${identifier// - / }"`
identifier=`echo "$prefix${identifier//[ ・]/-}"`
identifier=`echo $identifier | tr '[:upper:]' '[:lower:]'`
echo "$identifier"
mediatype="texts"
title="$trimmed_en"
description="Instruction Manual for:<br><br>$trimmed_en<br>$trimmed_ja"
subject="epoch;toy;manual;instructions"
creator="EPOCH"
echo "$identifier,./$file,$description,$subject,$title,$creator,$mediatype,jpn" >> epoch.csv
done
@gingerbeardman

This comment has been minimized.

Copy link
Owner Author

@gingerbeardman gingerbeardman commented Dec 26, 2020

Expects PDFs to be stored locally, with titles in two files ja.txt and en.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment