summaryrefslogtreecommitdiff
path: root/pm-index
blob: e497c0d302789cbf16dcff37afb43118f19be0e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh

dir=`dirname "$0"`

if [ "$#" -eq 0 ]
then
  echo "Must supply path for indexed files"
  exit 1
fi

target="$1"

target=${target%/}

find "$target" -name "*.e2x.gz" -delete

for fl in *.xml.gz
do
  base=${fl%.xml.gz}
  echo "$base"
  seconds_start=$(date "+%s")
  if [ -s "$dir/meshtree.txt" ]
  then
    gunzip -c "$fl" |
    xtract -transform "$dir/meshtree.txt" -e2index |
    gzip -1 > "$target/$base.e2x.gz"
  else
    gunzip -c "$fl" |
    xtract -e2index |
    gzip -1 > "$target/$base.e2x.gz"
  fi
  seconds_end=$(date "+%s")
  seconds=$((seconds_end - seconds_start))
  echo "$seconds seconds"
  sleep 1
done