Commit | Line | Data |
---|---|---|
5058c3b5 | 1 | #!/bin/sh |
670f510f | 2 | # cleanvolumes.sh 1.2 %G% |
5058c3b5 PC |
3 | # shell script to clean dumplog file |
4 | # | |
670f510f | 5 | PATH=:/etc/:/bin:/usr/bin: |
5058c3b5 | 6 | # Name of logfile |
670f510f | 7 | DL=/etc/dumplog |
5058c3b5 PC |
8 | # Name of tmp files |
9 | DT=/tmp/dumpclean$$ | |
10 | DE=/tmp/dumpedit$$ | |
11 | trap "rm -f $DT $DE" 1 2 3 15 | |
12 | sed -e 's/:.*$//' $DL | | |
13 | sort | | |
14 | uniq -c | | |
15 | awk '{ if ($1 != 1) | |
16 | { | |
17 | for (i = 0; i < $1-1; i++) | |
18 | printf "1\n/%s/d\n", $2 | |
19 | } | |
20 | }' > $DE | |
21 | if [ -s $DE ] | |
22 | then | |
23 | cp $DL $DT | |
24 | echo "w" >> $DE | |
25 | echo "q" >> $DE | |
26 | ed $DT < $DE > /dev/null | |
27 | fi | |
28 | mv $DT $DL | |
29 | rm $DE |