i have a scenario where i want to check the below details in files match the syntax
Syntax : NAME/SURNAME/COUNTRY
Note : every record in file should match the syntax. if one records does not match then should display failed or success
File data
Ajay/abc/india
Avik/bcs/delhi
Viraj/xyz/
As you can see the file data the last record does not match according to the syntax then should display failed
My code
for i in `cat /demo/Student.txt`
do
check=`echo $i | cut -d '/' -f3`
if [[ -z $check ]];
then
echo failed syntax does not match NAME/SURNAME/COUNTRY
exit 1
fi
done