Commit a43fee31 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

new tool

This is a legacy commit from before 2015-05-18.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 5365
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 45bb7135
#!/bin/sh
# this is <csmksed.sh>
# ----------------------------------------------------------------------------
# $Id$
#
# Copyright (c) 2013 by Thomas Forbriger (BFO Schiltach)
#
# a shell script to create sed scripts for cleaning up checksum files
#
# REVISIONS and CHANGES
# 26/11/2013 V1.0 Thomas Forbriger
#
# ============================================================================
#
function usage {
echo "This is $0"
echo '$Id$'
echo This shell expects file names as command line arguments. Each of
echo these files contains a list of absolute path name to data files.
echo Entries in checksum.cs for these data files shall be removed.
echo For this purpose a set of sed shell scripts is created.
echo
echo Created shell scripts than have to be executed manually. No
echo modification of checksum files will be done by this script.
}
# ----------------------------------------------------------------------------
function dirnames {
read a
while test -n "$a"
do
/usr/bin/dirname $a
read a
done
}
# ----------------------------------------------------------------------------
function sedcmd {
read a
while test -n "$a"
do
echo /$(basename $a)/d
read a
done
}
# ----------------------------------------------------------------------------
function mksed {
FL=$1
read a
while test -n "$a"
do
ID=$(echo $a | /usr/bin/tr '/' '_')
SEDFILE=sed$ID
SHFILE=sh$ID
/usr/bin/grep $a $FL | sedcmd > $SEDFILE
echo "#!/bin/sh" > $SHFILE
echo 'BUX=$(/usr/bin/date +"%Y_%m_%d_%H%M")' >> $SHFILE
echo '/usr/bin/sed --file='$SEDFILE' --in-place=$BUX '$a'/checksumfile.cs' >> $SHFILE
echo '/usr/bin/mv -fv '$SEDFILE' '$SEDFILE'.used' >> $SHFILE
/usr/bin/chmod +x $SHFILE
read a
done
}
# ----------------------------------------------------------------------------
if test $# -lt 1
then
usage
exit 2
fi
TMPBASE=$(/usr/bin/mktemp)
trap "/bin/rm -fv ${TMPBASE}*" HUP KILL QUIT ABRT INT TERM EXIT
FULLLIST=$TMPBASE.fl
/usr/bin/cat $* > $FULLLIST
PATHLIST=$TMPBASE.pl
/usr/bin/cat $* | dirnames | /usr/bin/sort | /usr/bin/uniq > $PATHLIST
/usr/bin/cat $PATHLIST | mksed $FULLLIST
# ----- END OF csmksed.sh -----
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment