Getting error in if loop

Hi All,

while executing this code ,I'm gettign below Error

if_test: line 3: [: too many arguments
if_test: line 6: [: too many arguments
 
#!/bin/bash
if [ grep -i "admin_1" longrunning_edit.csv  -gt 0 ];
then
echo "this is aginity;"
elif [  grep -i "admin_2" longrunning_edit.csv  -gt 0 ];
then
echo "this is informatica;"
fi
exit

Please Help!!

if [ $(grep -i "admin_1" longrunning_edit.csv) -gt 0 ]
then
    echo "this is aginity;"
elif [  $(grep -i "admin_2" longrunning_edit.csv) -gt 0 ]
then
    echo "this is informatica;"
fi

Thanks for quick reply..!!

I changed the code and now I'm getting this Error.

 
if_test: line 1: [: -gt: unary operator expected
if_test: line 4: [: -gt: unary operator expected

If you want grep to return the number of lines matching the search expression, you need the -c option

if [ $(grep -ic "admin_1" longrunning_edit.csv) -gt 0 ]
then
    echo "this is aginity;"
elif [  $(grep -ic "admin_2" longrunning_edit.csv) -gt 0 ]
then
    echo "this is informatica;"
fi