Listing 7 list_added.sh
#!/bin/ksh
#**************************************************************
# Listing 7:
# File: list_added.sh
#
# Description:
#
# This script takes a file generated by the compare command and
# lists the files that were added.
#
# Author: John Spurgeon (john.p.spurgeon@intel.com)
#
#**************************************************************
if [ "$#" -ne 1 ]
then
echo "[$(basename $0)] usage: $(basename $0) filename" >& 2
exit 1
fi
FILE=$1
if ! [ -f $FILE ]
then
echo "[$(basename $0)] Error: $FILE does not exist!" >& 2
exit 1
fi
awk 'BEGIN {last = ""}
{
if ($1 == ">") {
if ($2 != last) {
print $2
}
}
last = $2
}' $FILE
#!/bin/ksh
|