File tree 1 file changed +14
-9
lines changed
1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 10
10
# Caution: you may need to use GNU awk.
11
11
AWK=${AWK:- awk}
12
12
13
- trap " rm -f /tmp/$$ /tmp/$$ a /tmp/$$ b" 0 1 2 3 15
13
+ INPUTFILE=" tmp$$ a"
14
+ DUPSFILE=" tmp$$ b"
15
+ NONDUPSFILE=" tmp$$ c"
16
+ rm -f $INPUTFILE $DUPSFILE $NONDUPSFILE
17
+
18
+ trap " rm -f $INPUTFILE $DUPSFILE $NONDUPSFILE " 0 1 2 3 15
14
19
15
20
# Read input
16
- cat " $@ " > /tmp/ $$
21
+ cat " $@ " > $INPUTFILE
17
22
18
23
# Look for fields with multiple references.
19
- cat /tmp/ $$ | cut -d' ' -f2 | sort | uniq -d > /tmp/ $$ a
20
- if [ -s /tmp/ $$ a ] ; then
24
+ cat $INPUTFILE | cut -d' ' -f2 | sort | uniq -d > $DUPSFILE
25
+ if [ -s $DUPSFILE ] ; then
21
26
echo " Ignoring these fields that link to multiple tables:" 1>&2
22
- cat /tmp/ $$ a 1>&2
27
+ cat $DUPSFILE 1>&2
23
28
fi
24
29
25
30
# Get the non-multiply-referenced fields.
26
- cat /tmp/ $$ | while read LINE
31
+ cat $INPUTFILE | while read LINE
27
32
do
28
33
set -- $LINE
29
- grep " ^$2 \$ " /tmp/ $$ a > /dev/null 2>&1 || echo $LINE
30
- done > /tmp/ $$ b
34
+ grep " ^$2 \$ " $DUPSFILE > /dev/null 2>&1 || echo $LINE
35
+ done > $NONDUPSFILE
31
36
32
37
# Generate the output.
33
- cat /tmp/ $$ b |
38
+ cat $NONDUPSFILE |
34
39
$AWK -F' [ \.]' ' \
35
40
BEGIN \
36
41
{
You can’t perform that action at this time.
0 commit comments