Debian Codegraph @

test-pmc-index

raw
1 #!/bin/bash
2
3 # Public domain notice for all NCBI EDirect scripts is located at:
4 # https://www.ncbi.nlm.nih.gov/books/NBK179288/#chapter6.Public_Domain_Notice
5
6 seconds_start=$(date "+%s")
7
8 for i in {1..100}
9 do
10 echo $(( ( 1 + RANDOM % 9000) * 1000 + ( RANDOM % 1000) ))
11 done |
12 sort -n |
13 uniq |
14 xfetch -db pmc |
15 xtract -pattern PMCInfo -element CIT/UID TITLE/TEXT |
16 ( while IFS=$'\t' read uid ttl
17 do
18 if [ "$ttl" = "[Not Available]." ]
19 then
20 echo "$uid SKIP"
21 continue
22 fi
23 if [ "$ttl" = "Health." ]
24 then
25 echo "$uid SKIP"
26 continue
27 fi
28 if [ -z "$ttl" ]
29 then
30 echo "$uid TRIM -- $ttl"
31 continue
32 fi
33 res=$( xsearch -db pmc -title "$ttl" )
34 report="1"
35 if [ -z "$res" ]
36 then
37 echo "$uid NONE -- $ttl"
38 continue
39 fi
40 num=$( echo "$res" | wc -l | tr -d '[:space:]' )
41 echo "$res" |
42 while read pmid
43 do
44 if [[ $uid =~ $pmid ]]
45 then
46 if [ "$num" -lt 2 ]
47 then
48 echo "$uid OKAY -- $ttl"
49 else
50 echo "$uid MULT ${num## } -- $ttl"
51 fi
52 report="0"
53 break
54 fi
55 done
56 if [ "$report" -lt 1 ]
57 then
58 echo "$uid FAIL $num -- $ttl"
59 fi
60 done )
61
62 echo ""
63
64 seconds_end=$(date "+%s")
65 seconds=$((seconds_end - seconds_start))
66 echo "$seconds seconds"