date and time created 84/08/01 13:51:44 by pc
[unix-history] / usr / src / local / ukc / dump / cleanvolumes.sh
CommitLineData
5058c3b5 1#!/bin/sh
670f510f 2# cleanvolumes.sh 1.2 %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$$
11trap "rm -f $DT $DE" 1 2 3 15
12sed -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
21if [ -s $DE ]
22then
23 cp $DL $DT
24 echo "w" >> $DE
25 echo "q" >> $DE
26 ed $DT < $DE > /dev/null
27fi
28mv $DT $DL
29rm $DE