Last change
on this file since 623 was
579,
checked in by torrento, 13 years ago
|
version adaptee a grid engin (ana)
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # transforme les dates en nombre de seconde depuis minuit |
---|
3 | # pour reecrire les start/stop des differentes phases du fichier sca |
---|
4 | |
---|
5 | AWK=/bin/awk |
---|
6 | SED=/bin/sed |
---|
7 | GREP=/bin/grep |
---|
8 | WC=/usr/bin/wc |
---|
9 | RM=/bin/rm |
---|
10 | CAT=/bin/cat |
---|
11 | TOUCH=/bin/touch |
---|
12 | DATE=/bin/date |
---|
13 | ECHO=/bin/echo |
---|
14 | LS=/bin/ls |
---|
15 | MKDIR=/bin/mkdir |
---|
16 | DefaultIFS=$' \t\n' |
---|
17 | IFS=$DefaultIFS |
---|
18 | |
---|
19 | |
---|
20 | scriptName="`basename $0`" |
---|
21 | $ECHO "Processing script ${scriptName} at `date`" |
---|
22 | |
---|
23 | #temporary files to synchronize scripts |
---|
24 | tmppublicpath=${TMPPUBLICPATH} |
---|
25 | $LS -l ${tmppublicpath} > /dev/null |
---|
26 | |
---|
27 | #Path where the job will do temporary IO |
---|
28 | . ${SCRIPTPATH}/set_iojobpath.sh |
---|
29 | iojobpath=$(set_iojobpath) |
---|
30 | cd ${iojobpath} |
---|
31 | |
---|
32 | if [ ! $# = 1 ]; then |
---|
33 | $ECHO "FATAL (${scriptName}) usage: ./transdate.sh <scaXYZ.sum>" |
---|
34 | exit 0 |
---|
35 | fi |
---|
36 | |
---|
37 | #inputs x-chexk sca file |
---|
38 | inScaFile=$1 |
---|
39 | if [ ! -e $inScaFile ]; then |
---|
40 | $ECHO "FATAL (${scriptName}): $inScaFile not found" |
---|
41 | exit 1 |
---|
42 | fi |
---|
43 | |
---|
44 | $AWK -v datesys=$DATE ' |
---|
45 | BEGIN { |
---|
46 | FS=","; |
---|
47 | } |
---|
48 | |
---|
49 | { |
---|
50 | cycle=$1; |
---|
51 | for (i=2; i<=NF; i++) { |
---|
52 | cmd=sprintf("%s +%%F -d \"%s\" ",datesys,$i); |
---|
53 | (cmd | getline day); |
---|
54 | close(cmd); |
---|
55 | cmd=sprintf("%s +%%s -d \"%s\" ",datesys,day); |
---|
56 | (cmd | getline s0); |
---|
57 | close(cmd); |
---|
58 | cmd=sprintf("%s +%%s -d \"%s\" ",datesys,$i); |
---|
59 | (cmd | getline s1); |
---|
60 | close(cmd); |
---|
61 | $i = s1 - s0; |
---|
62 | } |
---|
63 | print $0; |
---|
64 | } |
---|
65 | |
---|
66 | ' $inScaFile >> $inScaFile.trans |
---|
67 | |
---|
68 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.