Bonjour, Actuellement je fais un petit script pour ne pas m'embeter a faire l'analyse a la main sur 13000 fichiers ( ca se comprend )

Le principe est assez simple, pour l'instant je regarde le temps de calcul de chaque simulation que je veux optimiser pour obtenir un temps de calcul plus ou moins equivalant.

Le script que j'ai cree est le suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
 
OTP=/scratch/theoric2/werner/public/outp
REP1=/users/theoric/sophys/EPOS/Check/gg2mw24a
REP2=/users/theoric/sophys/EPOS/Check/gg2mw24b
 
NMF=12782
 
###################################################################
 
                       #files in gg2mw24a
 
###################################################################
 
if [ ! -d $CHK/gg2mw24a ]; then cd $CHK ; mkdir gg2mw24a; fi
 
cd $OTP/gg2mw24a/1
 
echo "##########################################################################" > $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "                               file gg2mw24a/1                            " >> $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "" >> $REP1/users_time.txt
 
for i in `seq 1 10000`; do
  if [ -f $OTP/gg2mw24a/1/z-gg2mw24a-$i.oxx ]; then
    echo "$i,`grep user z-gg2mw24a-$i.oxx` " >> $REP1/users_time.txt
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP1/users_time.txt
    fi
  else
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP1/users_time.txt
    fi
  fi
done
 
 
cd $OTP/gg2mw24a/2
 
echo "" >> $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "                               file gg2mw24a/2                            " >> $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "##########################################################################" >> $REP1/users_time.txt
echo "" >> $REP1/users_time.txt
 
for i in `seq 10000 $NMF`; do
  if [ -f $OTP/gg2mw24a/2/z-gg2mw24a-$i.oxx ]; then
    echo "$i,`grep user z-gg2mw24a-$i.oxx` " >> $REP1/users_time.txt
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP1/users_time.txt
    fi
  else
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP1/users_time.txt
    fi
  fi
done
 
###############################################################
 
                    #files in gg2mw24b
 
###############################################################
 
if [ ! -d $CHK/gg2mw24b ]; then cd $CHK ; mkdir gg2mw24b; fi
 
cd $OTP/gg2mw24b/1
 
echo "##########################################################################" > $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "                               file gg2mw24b/1                            " >> $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "" >> $REP2/users_time.txt
 
for i in `seq 1 10000`; do
  if [ -f $OTP/gg2mw24b/1/z-gg2mw24b-$i.oxx ]; then
    echo "$i,`grep user z-gg2mw24b-$i.oxx` " >> $REP2/users_time.txt
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP2/users_time.txt
    fi
  else
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP2/users_time.txt
    fi
  fi
done
 
cd $OTP/gg2mw24b/2
 
echo "" >> $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "                               file gg2mw24b/2                            " >> $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "##########################################################################" >> $REP2/users_time.txt
echo "" >> $REP2/users_time.txt
 
for i in `seq 10000 $NMF`; do
  if [ -f $OTP/gg2mw24b/2/z-gg2mw24b-$i.oxx ]; then
    echo "$i,`grep user z-gg2mw24b-$i.oxx` " >> $REP2/users_time.txt
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP2/users_time.txt
    fi
  else
    if [ `${MTH}mod $i 20` -eq 0 ]; then
      echo " " >> $REP2/users_time.txt
    fi
  fi
done
 
echo " Job Finished "
Donc la j'ai la chose que je recherche a la base, donc mes temps de calculs qui sont sur la meme ligne que user (grep user blabla)

Mais maintenant tout se complique, j'aimerais prendre les nombres juste apres le user (dans chaque fichier) et les divise par un autre nombre qui est le premier des temps de user.

En gros ce que j'aimerais faire est de faire un grep qui pourrait me permettre de prendre ce qu'il y a sur la ligne APRES ce que j'ai mis dans grep.

J'ai recherche pendant une petite heure sur la toile et rien ne m'est apparu ...

Help ????