File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 1010# Caution: you may need to use GNU awk.
1111AWK=${AWK:- awk}
1212
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
1419
1520# Read input
16- cat " $@ " > /tmp/ $$
21+ cat " $@ " > $INPUTFILE
1722
1823# 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
2126 echo " Ignoring these fields that link to multiple tables:" 1>&2
22- cat /tmp/ $$ a 1>&2
27+ cat $DUPSFILE 1>&2
2328fi
2429
2530# Get the non-multiply-referenced fields.
26- cat /tmp/ $$ | while read LINE
31+ cat $INPUTFILE | while read LINE
2732do
2833 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
3136
3237# Generate the output.
33- cat /tmp/ $$ b |
38+ cat $NONDUPSFILE |
3439$AWK -F' [ \.]' ' \
3540 BEGIN \
3641 {
You can’t perform that action at this time.
0 commit comments