Hi,
I have a text file in the below format.
$cat my_paramater_file.txt
'
[FOLDER_NAME.WF:wf_my_workflow.ST:S_my_session]
$$ETL_EXTRACT_DATE=07/17/2011 17:55:05.000000
'
$
Would like to write script based on the below requirements.
- The file should not be 0 byte.
- The content of the file should be 4 lines and the ETL_EXTRACT_DATE field should contain the date and time values.
- If the file is 0 byte or there is no value for the ETL_EXTRACT_DATE field then it should send an alert message.
Could you please help me how to write a script base don above requirements.
Hi,
If u want, then need to do some modifications in below script and use...
clear
echo -n "Enter the name of file : "
read name
echo "Checking the existance of file $name"
echo
echo ".................................................."
sleep 2
ls -lrt $name
echo "Checking the size of file"
echo
sleep 2
size=`ls -lrt $name | awk '{print $5}'`
echo "******Size of $name is $size bytes"
echo
sleep 2
echo "Checking the number of lines"
echo
sleep 2
line=`wc -l $name | awk '{print $1}'`
echo "******$name is containing $line lines"
echo
sleep 2
echo "Checking the value of ETL_EXTRACT_DATE"
echo
sleep 2
value=`cat $name | grep ETL_EXTRACT_DATE | sed 's/\(.*\)=\(.*\)/\2/'`
echo "******Value of ETL_EXTRACT_DATE is $value"
echo
sleep 2
if [ $size == 0 -o $value == ]
then
echo "the file is 0 byte or there is no value for the ETL_EXTRACT_DATE field .."
fi