source: branches/bibliolocean/src/checkaeres.sh @ 226

Last change on this file since 226 was 216, checked in by pinsard, 12 years ago

add check tool (to be cont.)

  • Property svn:executable set to *
  • Property svn:keywords set to Id URL
File size: 5.0 KB
Line 
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#-
53set -u
54command=$(basename ${0})
55#
56system=$(uname)
57case "${system}" in
58   AIX|IRIX64)
59      echo "${command} : www : no specific posix checking"
60   ;;
61   *)
62      set -o posix
63   ;;
64esac
65#
66usage=" Usage : ${command}"
67#
68# test if bibtool available
69tool=bibtool
70type ${tool} 1> /dev/null 2>&1
71status=${?}
72if [ ${status} -ne 0 ]
73then
74   echo "${command} : eee : ${tool} unavailable" >&2
75   exit 1
76fi
77unset tool
78unset status
79#
80# test if bib2bib available
81tool=bib2bib
82type ${tool} 1> /dev/null 2>&1
83status=${?}
84if [ ${status} -ne 0 ]
85then
86   echo "${command} : eee : ${tool} unavailable" >&2
87   exit 1
88fi
89unset tool
90unset status
91#
92#
93# default
94# n.a.
95#
96hostname=$(hostname)
97tmpdir=${PROJECT_LOG}/aeres2007_2012check/
98dirwww=${PROJECT_OD}/aeres2007_2012check/
99rm -rf ${tmpdir} 2> /dev/null
100mkdir -p ${tmpdir}
101rm -rf ${dirwww} 2> /dev/null
102mkdir -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
110biblioref_orig=${PROJECT_ID}/biblioref.bib
111biblioreffull=${tmpdir}/all.bib
112cp ${biblioref_orig} ${biblioreffull}
113#
114# check for missing year
115nbmissingyear=0
116fbibmissingyear=${tmpdir}/missingyear.bib
117fcitemissingyear=${tmpdir}/missingyear_cite.bib
118rm ${tmpdir}/missingyear.bib 2> /dev/null
119bib2bib -c 'not exists year' \
120-ob ${fbibmissingyear} \
121-oc ${fcitemissingyear} \
122${biblioreffull} 
123more ${fcitemissingyear}
124echo ${missingyear}
125if [ -s ${fcitemissingyear} ]
126then
127    echo " ${LINENO} : eee : some missing years in ${biblioreffull}"
128    echo " see ${fcitemissingyear}"
129    #++exit 1
130else
131    echo " ${LINENO} : iii : no missing year in ${biblioreffull}"
132    rm ${fcitemissingyear}
133fi
134unset missingyear
135rm ${fcitemissingyear}
136rm ${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 ))
173done # end of team loop
174unset iteam
175unset nbteam
176unset list_year
177unset fteam
178#
179echo "${LINENO}: iii: list_fteamyear = ${list_fteamyear}"
180#
181# define jabref header
182# ++ usefull
183jabref_header ${tmpdir}/header_jabref
184#
185# loop on aerestype
186list_aerestype="ACL ACLN ASCL BRE C-INV C-ACTI C-ATCN C-COM C-AFF DO OR OS PV PAT PT AP"
187for aerestype in ${list_aerestype}
188do
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
215done # 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
222exit 0
Note: See TracBrowser for help on using the repository browser.