Annotation of web/expand.sh, Revision 1.2
1.1 hako 1: #!/bin/sh
2: # Expand article-xml files from a single xml file (publication data) made by BibDesk of OSX
3: # by Hiroshi Hakoyama
4: # POSIX sh
5: # example:
6: # cd www/publications
7: # expand.sh ~/web/papers.xml
8: # make
9:
10: filename=$1
11: tmpfile=$(mktemp)
12: cp ${filename} ${tmpfile}
13:
14: # some dirty modifications
1.2 ! hako 15: (rm ${tmpfile}; sed s/"箱山, 洋."/"箱山 洋"/g > ${tmpfile}) < ${tmpfile}
! 16: (rm ${tmpfile}; sed s/"巌佐, 庸."/"巌佐 庸"/g > ${tmpfile}) < ${tmpfile}
! 17: (rm ${tmpfile}; sed /\>NA\</d > ${tmpfile}) < ${tmpfile}
! 18: (rm ${tmpfile}; sed /\>NA\./d > ${tmpfile}) < ${tmpfile}
! 19: (rm ${tmpfile}; sed -E 's/\?\./\?/g' > ${tmpfile}) < ${tmpfile}
! 20: (rm ${tmpfile}; sed -E 's/?\./?/g' > ${tmpfile}) < ${tmpfile}
1.1 hako 21:
22: # list of the start line-number and end line-number of articles
23: start=`sed -n '/<article/=' ${tmpfile}`
24: end=`sed -n '/article>/=' ${tmpfile}`
25:
26: # make article files
27: set $start
28: i=1
29: length=$#
30: while test $i -le $length ; do
31: set dummy $start
32: shift $i
33: s=$1
34: set dummy $end
35: shift $i
36: e=$1
37: id=`sed -n ${s}p ${tmpfile} | sed -e 's/[^"]*"\([^"]*\)".*/\1/'`
38: sed -n ${s},${e}p ${tmpfile} > $id.xml
39: i=`expr $i + 1`
40: done
41:
42: rm ${tmpfile}
43:
44: exit 0