The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-08-2006
sivakumarvenkat sivakumarvenkat is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 2
Smile

Hi,

Thanks for your reply. I completed the code, but if you can help me to modify the code then it will be really good.

for filename in *.*
do
PTYPE=`head -1 $filename | cut -c 14-14`
##echo $PTYPE
if [ $PTYPE = 'M' ]
then
FILE_PERIOD=`head -1 $filename | cut -c 12-16`
DATA_PERIOD=`head -2 $filename | tail -1 | cut -c 11-15`
elif [ $PTYPE = 'Q' ]
then
FILE_PERIOD=`head -1 $filename | cut -c 12-15`
DATA_PERIOD=`head -2 $filename | tail -1 | cut -c 11-14`
else
echo "Period in the fie $filename is not correct : $DATA_PERIOD "
fi
if [ $FILE_PERIOD = $DATA_PERIOD ]
then echo "File $filename Loading for Period : $FILE_PERIOD "
else
echo "Wrong File for the period $FILE_PERIOD in the $filename period is $DATA_PERIOD "
fi
done