xref: /original-bsd/local/ukc/dump/cleanvolumes.sh (revision acfb0788)
1#!/bin/sh
2#	cleanvolumes.sh	1.4	08/06/84
3#	shell script to clean dumplog file
4#
5PATH=:/etc/:/bin:/usr/bin:
6#	Name of	logfile
7DL=/etc/dumplog
8#	Name of tmp files
9DT=/tmp/dumpclean$$
10DE=/tmp/dumpedit$$
11export DT
12export DE
13trap "rm -f $DT $DE" 1 2 3 15
14sed -e 's/:.*$//' $DL |
15	sort |
16	uniq -c |
17	awk	'{	if ($1 != 1)
18			{
19				for (i = 0; i < $1-1; i++)
20					printf "$\n/%s/d\n", $2
21			}
22		}' > $DE
23if [ -s $DE ]
24then
25	cp $DL $DT
26	echo "w" >> $DE
27	echo "q" >> $DE
28	ed $DT < $DE > /dev/null
29	mv $DT $DL
30fi
31rm -f $DE
32