-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepes.sh
32 lines (30 loc) · 1.01 KB
/
repes.sh
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
#!/bin/bash
entrada="ent.csv"
cnt=1
total=`wc -l $entrada | cut -f 1 -d' '`
echo "Total de socis: $total"
while [ $cnt -le $total ]
do
line=`cat $entrada | head --lines=$cnt | tail --lines=1`
cognom=`echo "$line" | cut -f 4 -d',' | tr "[:upper:]" "[:lower:]" | sed 's/\([a-zÇ-Ý]\)\([a-zA-Z0-9]*\)/\u\1\2/g'`
nom=`echo "$line" | cut -f 3 -d',' | tr "[:upper:]" "[:lower:]" | sed 's/\([a-zÇ-Ý]\)\([a-zA-Z0-9]*\)/\u\1\2/g'`
buscar="$cnt"
let buscar=buscar+1
while [ $buscar -le $total ]
do
lineB=`cat $entrada | head --lines=$buscar | tail --lines=1`
cognomB=`echo "$lineB" | cut -f 4 -d',' | tr "[:upper:]" "[:lower:]" | sed 's/\([a-zÇ-Ý]\)\([a-zA-Z0-9]*\)/\u\1\2/g'`
nomB=`echo "$lineB" | cut -f 3 -d',' | tr "[:upper:]" "[:lower:]" | sed 's/\([a-zÇ-Ý]\)\([a-zA-Z0-9]*\)/\u\1\2/g'`
if [ "$cognomB" = "$cognom" ]
then
echo "Cognom repe: $cognom"
if [ "$nomB" = "$nom" ]
then
echo "Nom i cognom repes: $nom $cognom"
fi
fi
let buscar=buscar+1
done
let cnt=cnt+1
#break;
done