Statistiques
| Branche: | Révision :

meplib / 00model / dirtyUpCandidates.sh @ master

Historique | Voir | Annoter | Télécharger (728 octet)

1
#! /bin/sh
2
#
3
# Dirty up the output of the candidates filtered by filter-solutions !
4
# (Nasty idea is not it?)
5
#
6
if [ -z $1 ]
7
  then
8
    echo
9
    echo
10
    echo "Usage: "`basename $0`" clean_candidates_file_name"
11
    echo
12
    echo
13
    exit 1
14
fi
15
if [ ! -f $1 ]
16
  then
17
    echo
18
    echo
19
    echo -n `basename $0`": can not open the \"$1\" file. "
20
    echo "Aborting the program!"
21
    echo
22
    echo
23
    exit 1
24
fi
25
NUM_DIRTY=`grep "^A\[" $1 | wc -l`
26
if [ $NUM_DIRTY -gt 0 ]
27
  then
28
    echo
29
    echo
30
    echo -n `basename $0`": \"$1\" is not a clean candidates file. "
31
    echo "Aborting the program!"
32
    echo
33
    echo
34
    exit 1
35
fi
36
cat $1 | awk '{printf "A[%d]=[",NR;ind=1;while(ind < NF){printf "%s,", $ind; ind+=1};print $NF"]:" }'