Skip to content

Instantly share code, notes, and snippets.

@haoess
Created January 18, 2011 14:30
Show Gist options
  • Save haoess/784493 to your computer and use it in GitHub Desktop.
Save haoess/784493 to your computer and use it in GitHub Desktop.
#!/bin/bash
xmlstarlet sel -N tei="http://www.tei-c.org/ns/1.0" -t -f -o " " -m "//tei:bibl[@type='source']/tei:title" -c "." -n pj10*/*Z.xml | perl -0777 -nE 's/xmlns="[^"]+"//g;s/\.\.\/database\/journals\/journals. xml/\&journals;/g;s/\s{2,}/ /g;s/([^>])\n/\1/g;s/xml\s/xml\n/g;s/\s(pj\d{3})/\n\1/g;print "$_\n"' | grep '\(pj\|jour"\)' | perl -nE 'chomp;if(/^pj/){$v=$_}else{$v{$v}++}; END { printf "%s: %d\n", $_, $v{$_} for sort { $v{$a} cmp $v{$b} } keys %v}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment