date and time created 87/08/07 18:38:13 by pc
[unix-history] / usr / src / local / ukc / dump / cleanvolumes.sh
CommitLineData
5058c3b5 1#!/bin/sh
561223b1 2# cleanvolumes.sh 1.4 %G%
5058c3b5
PC
3# shell script to clean dumplog file
4#
670f510f 5PATH=:/etc/:/bin:/usr/bin:
5058c3b5 6# Name of logfile
670f510f 7DL=/etc/dumplog
5058c3b5
PC
8# Name of tmp files
9DT=/tmp/dumpclean$$
10DE=/tmp/dumpedit$$
02ba6f08
PC
11export DT
12export DE
5058c3b5
PC
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++)
561223b1 20 printf "$\n/%s/d\n", $2
5058c3b5
PC
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
02ba6f08 29 mv $DT $DL
5058c3b5 30fi
02ba6f08 31rm -f $DE