Skip to content

Instantly share code, notes, and snippets.

@horaciod
Created February 18, 2019 03:35
Show Gist options
  • Select an option

  • Save horaciod/fc5f2a67149cf3a16a6d519854c95a2e to your computer and use it in GitHub Desktop.

Select an option

Save horaciod/fc5f2a67149cf3a16a6d519854c95a2e to your computer and use it in GitHub Desktop.
extracción de url y nombre de revistas de un directorio repleto de xmls resultado de una cosecha OAI/PMH
#!/bin/bash
echo "" >/tmp/titulos.txt
echo "">/tmp/url.txt
for file in *.xml
do
xmlstarlet sel -t -m '//dc:source[1]' -v . -n < ${file} >>/tmp/titulos.txt
xmlstarlet sel -t -m '//dc:identifier[1]' -v . -n < ${file} >>/tmp/url.txt
done
cut -d ';' -f 1 < /tmp/titulos.txt |sort | uniq > titulosrevistas.txt
cut -d '/' -f -6 < /tmp/url.txt |sort | uniq > urlrevistas.txt
sed -i -- 's/article//g' urlrevistas.txt
sed -i -- 's/view//g' urlrevistas.txt
cat urlrevistas.txt
cat titulosrevistas.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment