1 | #!/bin/sh |
---|
2 | #liste des "sources" enregistrees sous Amas |
---|
3 | GREP=/bin/grep |
---|
4 | AWK=/bin/awk |
---|
5 | ECHO=/bin/echo |
---|
6 | MKDIR=/bin/mkdir |
---|
7 | CAT=/bin/cat |
---|
8 | PRINTF=/usr/bin/printf |
---|
9 | RM=/bin/rm |
---|
10 | SORT=/bin/sort |
---|
11 | XARGS=/usr/bin/xargs |
---|
12 | WC=/usr/bin/wc |
---|
13 | DefaultIFS=$' \t\n' |
---|
14 | IFS=$DefaultIFS |
---|
15 | |
---|
16 | # Irods environment settings |
---|
17 | . /usr/local/shared/bin/irods_env.sh -noverbose |
---|
18 | |
---|
19 | scriptName="`basename $0`" |
---|
20 | $ECHO "Processing script ${scriptName} at `date`" |
---|
21 | |
---|
22 | #Path to public backupable path |
---|
23 | publicpath="/afs/in2p3.fr/home/c/campagne/public" |
---|
24 | |
---|
25 | #Path where the job will do temporary IO |
---|
26 | . ${SCRIPTPATH}/set_iojobpath.sh |
---|
27 | iojobpath=$(set_iojobpath) |
---|
28 | cd ${iojobpath} |
---|
29 | |
---|
30 | |
---|
31 | OUT1=./baoils.$$ |
---|
32 | ils /baoradio/data/AmasNancay/ > ${OUT1} |
---|
33 | OUT2=./baoawk1.$$ |
---|
34 | $AWK '($1=="C-") {print $2}' ${OUT1} > ${OUT2} |
---|
35 | $RM $OUT1 |
---|
36 | #Sequence |
---|
37 | tableau=( `$CAT $OUT2 | $AWK '{print $1}'` ) |
---|
38 | IFS=' |
---|
39 | ' |
---|
40 | tableau=( $( $PRINTF "%s\n" "${tableau[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
41 | IFS=$DefaultIFS |
---|
42 | |
---|
43 | $RM $OUT2 |
---|
44 | |
---|
45 | for i in ${tableau[@]} |
---|
46 | do |
---|
47 | $ECHO "source $i" |
---|
48 | listedate=( `ils $i | $AWK '($1=="C-"){print $2}'`) |
---|
49 | IFS=' |
---|
50 | ' |
---|
51 | listedate=( $( $PRINTF "%s\n" "${listedate[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
52 | |
---|
53 | ntotfiles=0 |
---|
54 | for j in ${listedate[@]} |
---|
55 | do |
---|
56 | #Fiber 1 |
---|
57 | listOfsig1=( `ils ${j}/Fiber1 | $GREP -i "signal" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
58 | IFS=' |
---|
59 | ' |
---|
60 | listOfsig1=( $( $PRINTF "%s\n" "${listOfsig1[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
61 | nblinesSIG1=${#listOfsig1[@]} |
---|
62 | listOfhdr1=( `ils ${j}/Fiber1 | $GREP -i "header" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
63 | IFS=' |
---|
64 | ' |
---|
65 | listOfhdr1=( $( $PRINTF "%s\n" "${listOfhdr1[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
66 | nblinesHDR1=${#listOfhdr1[@]} |
---|
67 | |
---|
68 | #Fiber 2 |
---|
69 | listOfsig2=( `ils ${j}/Fiber2 | $GREP -i "signal" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
70 | IFS=' |
---|
71 | ' |
---|
72 | listOfsig2=( $( $PRINTF "%s\n" "${listOfsig2[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
73 | nblinesSIG2=${#listOfsig2[@]} |
---|
74 | listOfhdr2=( `ils ${j}/Fiber2 | $GREP -i "header" | $XARGS -i basename {} | $SORT -k1.7n` ) |
---|
75 | IFS=' |
---|
76 | ' |
---|
77 | listOfhdr2=( $( $PRINTF "%s\n" "${listOfhdr2[@]}" | $AWK 'x[$0]++ == 0' ) ) |
---|
78 | nblinesHDR2=${#listOfhdr2[@]} |
---|
79 | |
---|
80 | |
---|
81 | |
---|
82 | $ECHO ">>> $j ---> Fib1: $nblinesHDR1 / $nblinesSIG1 Fib2: $nblinesHDR2 / $nblinesSIG2" |
---|
83 | let "ntotfiles=ntotfiles+$nblinesSIG1" |
---|
84 | done |
---|
85 | $ECHO "total signal Fiber1 files = $ntotfiles" |
---|
86 | |
---|
87 | done |
---|