#!/bin/sh #======================================================================= # Merge a .ser file with a .sok file, deleting the .ser file. This # should NOT be done until the .ser file has been checked for spelling # errors that need fixing, and all such errors have been eliminated from # the .ser file. # # Usage: # ./MERGE-SER basename(s) # # For convenience, instead of basenames, you can specify filenames with # extension .bib, .ser, or .sok. # # [04-Oct-2003] -- add filter step to remove empty lines # [08-Jul-2003] -- update to support directory names, and create the # .sok file if it does not exist. # [08-May-1999] -- update to ignore empty .ser files, so .sok file is # not modified unnecessarily # [20-Sep-1994] #======================================================================= for file in $* do f=$file d=`dirname $f` # Allow certain selected file extensions for convenience f=$d/`basename $f .ser` f=$d/`basename $f .bib` f=$d/`basename $f .sok` if [ ! -f $f.sok ] then touch $f.sok fi if [ -f $f.ser -a -s $f.ser -a -f $f.sok ] then cat $f.sok >>$f.ser LC_ALL=C sort -u $f.ser | grep -v '^ *$' >$f.sok ls -l $f.sok fi if [ -f $f.ser ] then rm -f $f.ser fi done