1 | #! /bin/sh -x |
---|
2 | #+ |
---|
3 | # |
---|
4 | # =============== |
---|
5 | # checkaeres.sh |
---|
6 | # =============== |
---|
7 | # |
---|
8 | # SYNOPSIS |
---|
9 | # ======== |
---|
10 | # |
---|
11 | # :: |
---|
12 | # |
---|
13 | # checkaeres.sh |
---|
14 | # |
---|
15 | # DESCRIPTION |
---|
16 | # =========== |
---|
17 | # |
---|
18 | # check for missing values in .bib for aeres 2007-2012 |
---|
19 | # |
---|
20 | # EXAMPLES |
---|
21 | # ======== |
---|
22 | # |
---|
23 | # :: |
---|
24 | # |
---|
25 | # checkaeres.sh |
---|
26 | # |
---|
27 | # SEE ALSO |
---|
28 | # ======== |
---|
29 | # |
---|
30 | # genbib.sh |
---|
31 | # |
---|
32 | # genaeres.sh |
---|
33 | # |
---|
34 | # genaeres_rtf.sh |
---|
35 | # |
---|
36 | # TODO |
---|
37 | # ==== |
---|
38 | # |
---|
39 | # FINIR de régdiger |
---|
40 | # |
---|
41 | # log |
---|
42 | # |
---|
43 | # phybiocar theme |
---|
44 | # |
---|
45 | # EVOLUTIONS |
---|
46 | # ========== |
---|
47 | # |
---|
48 | # - fplod 20120629T161209Z cratos (Linux) |
---|
49 | # |
---|
50 | # * creation |
---|
51 | # |
---|
52 | #- |
---|
53 | set -u |
---|
54 | command=$(basename ${0}) |
---|
55 | # |
---|
56 | system=$(uname) |
---|
57 | case "${system}" in |
---|
58 | AIX|IRIX64) |
---|
59 | echo "${command} : www : no specific posix checking" |
---|
60 | ;; |
---|
61 | *) |
---|
62 | set -o posix |
---|
63 | ;; |
---|
64 | esac |
---|
65 | # |
---|
66 | usage=" Usage : ${command}" |
---|
67 | # |
---|
68 | # test if bibtool available |
---|
69 | tool=bibtool |
---|
70 | type ${tool} 1> /dev/null 2>&1 |
---|
71 | status=${?} |
---|
72 | if [ ${status} -ne 0 ] |
---|
73 | then |
---|
74 | echo "${command} : eee : ${tool} unavailable" >&2 |
---|
75 | exit 1 |
---|
76 | fi |
---|
77 | unset tool |
---|
78 | unset status |
---|
79 | # |
---|
80 | # test if bib2bib available |
---|
81 | tool=bib2bib |
---|
82 | type ${tool} 1> /dev/null 2>&1 |
---|
83 | status=${?} |
---|
84 | if [ ${status} -ne 0 ] |
---|
85 | then |
---|
86 | echo "${command} : eee : ${tool} unavailable" >&2 |
---|
87 | exit 1 |
---|
88 | fi |
---|
89 | unset tool |
---|
90 | unset status |
---|
91 | # |
---|
92 | # |
---|
93 | # default |
---|
94 | # n.a. |
---|
95 | # |
---|
96 | hostname=$(hostname) |
---|
97 | tmpdir=${PROJECT_LOG}/aeres2007_2012check/ |
---|
98 | dirwww=${PROJECT_OD}/aeres2007_2012check/ |
---|
99 | rm -rf ${tmpdir} 2> /dev/null |
---|
100 | mkdir -p ${tmpdir} |
---|
101 | rm -rf ${dirwww} 2> /dev/null |
---|
102 | mkdir -p ${dirwww} |
---|
103 | # |
---|
104 | . define_teams_aeres2007_2012.sh |
---|
105 | . define_phybiocar_theme.sh |
---|
106 | . jabref_rtf.sh |
---|
107 | . jabref_header.sh |
---|
108 | # |
---|
109 | # define bibliography reference file |
---|
110 | biblioref_orig=${PROJECT_ID}/biblioref.bib |
---|
111 | biblioreffull=${tmpdir}/all.bib |
---|
112 | cp ${biblioref_orig} ${biblioreffull} |
---|
113 | # |
---|
114 | # check for missing year |
---|
115 | nbmissingyear=0 |
---|
116 | fbibmissingyear=${tmpdir}/missingyear.bib |
---|
117 | fcitemissingyear=${tmpdir}/missingyear_cite.bib |
---|
118 | rm ${tmpdir}/missingyear.bib 2> /dev/null |
---|
119 | bib2bib -c 'not exists year' \ |
---|
120 | -ob ${fbibmissingyear} \ |
---|
121 | -oc ${fcitemissingyear} \ |
---|
122 | ${biblioreffull} |
---|
123 | more ${fcitemissingyear} |
---|
124 | echo ${missingyear} |
---|
125 | if [ -s ${fcitemissingyear} ] |
---|
126 | then |
---|
127 | echo " ${LINENO} : eee : some missing years in ${biblioreffull}" |
---|
128 | echo " see ${fcitemissingyear}" |
---|
129 | #++exit 1 |
---|
130 | else |
---|
131 | echo " ${LINENO} : iii : no missing year in ${biblioreffull}" |
---|
132 | rm ${fcitemissingyear} |
---|
133 | fi |
---|
134 | unset missingyear |
---|
135 | rm ${fcitemissingyear} |
---|
136 | rm ${fbibmissingyear} |
---|
137 | # |
---|
138 | ++++ la suite ... |
---|
139 | # check for missing aeresteam |
---|
140 | # check for missing aerestype |
---|
141 | # check for missing phybiocar theme |
---|
142 | # |
---|
143 | nbatteam=$(grep -c @ ${fteam}) |
---|
144 | if [ ${nbatteam} -ge 2 ] |
---|
145 | then |
---|
146 | echo "iii : $((${nbatteam} - 1)) ref for aeresteam ${list_team_title[${iteam}]}" |
---|
147 | for iyear in ${list_year} |
---|
148 | do |
---|
149 | echo "${LINENO} : iii: year = ${iyear}" |
---|
150 | fteamyear=${tmpdir}/$(basename ${fteam} .bib)_${iyear}.bib |
---|
151 | rm ${fteamyear} 2> /dev/null |
---|
152 | bibtool_command="bibtool -- 'select={year \"${iyear}\"}' ${fteam} -o ${fteamyear}" |
---|
153 | eval ${bibtool_command} |
---|
154 | unset bibtool_command |
---|
155 | # test if empty |
---|
156 | nbatteamyear=$(grep -c @ ${fteamyear}) |
---|
157 | if [ ${nbatteamyear} -ge 2 ] |
---|
158 | then |
---|
159 | echo "iii : $((${nbatteamyear} - 1)) ref for aeresteam ${list_team_title[${iteam}]} and year ${iyear}" |
---|
160 | list_fteamyear="${list_fteamyear} ${fteamyear}" |
---|
161 | else |
---|
162 | echo "www : no ref for aeresteam ${list_team_title[${iteam}]} and year ${iyear}" |
---|
163 | fi |
---|
164 | unset nbatteamyear |
---|
165 | done # end of year loop |
---|
166 | unset iyear |
---|
167 | else |
---|
168 | echo "www : no ref for aeresteam ${list_team_title[${iteam}]}" |
---|
169 | fi |
---|
170 | unset nbatteam |
---|
171 | unset nbatteamyear |
---|
172 | iteam=$(( ${iteam} + 1 )) |
---|
173 | done # end of team loop |
---|
174 | unset iteam |
---|
175 | unset nbteam |
---|
176 | unset list_year |
---|
177 | unset fteam |
---|
178 | # |
---|
179 | echo "${LINENO}: iii: list_fteamyear = ${list_fteamyear}" |
---|
180 | # |
---|
181 | # define jabref header |
---|
182 | # ++ usefull |
---|
183 | jabref_header ${tmpdir}/header_jabref |
---|
184 | # |
---|
185 | # loop on aerestype |
---|
186 | list_aerestype="ACL ACLN ASCL BRE C-INV C-ACTI C-ATCN C-COM C-AFF DO OR OS PV PAT PT AP" |
---|
187 | for aerestype in ${list_aerestype} |
---|
188 | do |
---|
189 | echo "${LINENO} : iii: aerestype = ${aerestype}" |
---|
190 | for fteamyear in ${list_fteamyear} |
---|
191 | do |
---|
192 | echo "${LINENO} : iii: fteamyear = ${fteamyear}" |
---|
193 | #++ add header |
---|
194 | fteamyeartype=${tmpdir}/$(basename ${fteamyear} .bib)_${aerestype}.bib |
---|
195 | rm ${fteamyeartype} 2> /dev/null |
---|
196 | bibtool_command="bibtool -- 'select={aerestype \"${aerestype}\"}' ${fteamyear} -o ${fteamyeartype}" |
---|
197 | eval ${bibtool_command} |
---|
198 | unset bibtool_command |
---|
199 | # test if empty |
---|
200 | nbatteamyeartype=$(grep -c @ ${fteamyeartype}) |
---|
201 | if [ ${nbatteamyeartype} -ge 2 ] |
---|
202 | then |
---|
203 | echo "iii : $((${nbatteamyeartype} - 1)) ref type ${aerestype} in ${fteamyear}" |
---|
204 | ofteamyeartype=${dirwww}/$(basename ${fteamyeartype} .bib).rtf |
---|
205 | rm ${ofteamyeartype} 2> /dev/null |
---|
206 | jabref_rtf \ |
---|
207 | ${PROJECT}/../branches/bibliolocean/src/jabref.preferences.xml \ |
---|
208 | ${fteamyeartype} ${ofteamyeartype} |
---|
209 | # ++ test si ok |
---|
210 | else |
---|
211 | echo "www : no ref type ${aerestype} in ${fteamyear}" |
---|
212 | fi |
---|
213 | unset nbatteamyeartype |
---|
214 | done # end of loop on fteamyear |
---|
215 | done # end of loop on aerestype |
---|
216 | # |
---|
217 | # clean |
---|
218 | #++rm ${biblioref} 2> /dev/null |
---|
219 | #++rm ${tmpdir}/header_jabref 2> /dev/null |
---|
220 | # |
---|
221 | # end |
---|
222 | exit 0 |
---|