Hi!
spelling out my requirements correctly:
There is one prop file which is like a constraint file. which contains keys to tell which are mandatory columns in a csv file.
Say MAN_COL=1,2,5,6
Now a script need to check the prop file first then to pick the value about mandatory columns.
Then it will go to csv file. Read it line by line. Check the mandatory columns if they have some value in it means they are not empty or null.
if they are null script will send a mail to some address.
otherwise it will return 0.
As m new n learning from ground i tried commands here m posting those one.
These are just commands need to combine them to make a working script for my requirement.
help needed..
help me out.
Here is the code tried by me:
Code:
#!/bin/bash
#while loop to read line by line
N=0
While read LINE ; do
N=$((N+1))
echo “Line $N = $LINE
done
# cut command to extract columns
cut –f 1,3,4 –d ‘|’ Jewson.csv
#if else clause to check the columns if they contain something or empty
if ($1==[a-zA-Z][0-9] && $2==[a-zA-Z][0-9] && $3==$1==[a-zA-Z][0-9])
then
return 0
else
#send mail to admin {code for sendmail server}
fi
Thanks a lot....