Rev 14048 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14051 | bpr | 1 | #!/bin/sh |
14048 | guerimand | 2 | # |
3 | # check endif and if number in a file |
||
4 | # use : checkifendif dirname |
||
5 | |||
6 | cd $1 |
||
14051 | bpr | 7 | list=`find . -mindepth 1 -type f`; |
14048 | guerimand | 8 | echo "**************************************************************************************" |
9 | echo "Recherche différence entre le nombre de if et endif dans les fichiers du répertoire $1" |
||
10 | echo "**************************************************************************************" |
||
11 | cpt=0 |
||
12 | for f in $list; do |
||
13 | nb=`awk 'BEGIN{cpt=0}; ! /^[ \t]*!!/ && /^[ \t]*!/ && /!if/{cpt++}; ! /^[ \t]*!!/ && /^[ \t]*!/ && /!endif/{cpt--}; END{print cpt};' $f;`; |
||
14 | cpt=$(expr $cpt + 1) |
||
15 | if [ $nb -gt 0 ]; then |
||
16 | echo "$f : $nb"; |
||
17 | fi |
||
18 | done |
||
19 | echo "Nombre de fichiers examinés : $cpt" |
||
20 | echo "Pour voir les lignes avec des if/endif du fichier monfichier taper la commande : " |
||
21 | echo "awk '! /^[ \t]*!!/ && /^[ \t]*!/ && /!if/{print FNR,\$0;}; ! /^[ \t]*!!/ && /^[ \t]*!/ && /!endif/{print FNR,\$0;};' monfichier"; |
||
22 |