#!/bin/sh # Filter one or more input files to reset the checksum field in a line # that looks like: # # %% checksum = "12345 327 1242 10167", # # where the first number is a CRC-16 checksum, and the remainder # are the same as produced by wc (lines, words, characters). # # All changes are left in a subdirectory, ./tmp. # # [10-Sep-1991] -- use new checksum utility # %% checksum = "327 1242 10167", # [16-Nov-1990] -- original version if [ ! -d tmp ] then mkdir tmp fi for f in $* do expand $f | sed -e 's/[ ]*$//' >$f.~0~ # checksum="`wc <$f.~0~ | sed -e s'/^ *//'" # sed -e s"/ checksum = \".*/ checksum = \"$checksum\",/" <$f.~0~ >tmp/$f checksum $f.~0~ tmp/$f if cmp $f.~0~ tmp/$f # don't save identical files then rm -f tmp/$f else echo ==================== $f ==================== diff $f tmp/$f fi rm -f $f.~0~ done