|
Creating an updated file
Hi,
I would like to define a script in order to update a file with the last updated records:
I wrote :
#!/bin/sh
YEAR=$(date +%Y)
MONTH=$(date +%m)
DAY=$(date +%d)
COMM=/usr/bin/comm
for file in * ;
do
if [[ "$file" = DPSTY*_$YEAR$MONTH$DAY* ]] ; then
FILE=${DPSTY}
UNIQUE=Unique_${FILE}
COMMON=Common_${FILE}
(${COMM} -3 $FILE $file) > $UNIQUE
(${COMM} -12 $FILE $file) > $COMMON
cat $UNIQUE $COMMON > $FILE
fi
done
Instead of updating the DPSTY file I got :
usage:comm [ -[123] ] file1 file2
usage:comm [ -[123] ] file1 file2
I don't know haw to do it.
Thanks
|