Searching and deleting from a file

Hi,

Iam using the below script for searching and deleting a pattern from a file:

#!/bin/ksh
if [grep $value redirects.virgin-atlantic.com.conf > dred1 && $? == 0] ; then
echo "Pattern exist in redirects.virgin-atlantic.com.conf"
sleep 1000
sed '/"$value"/d' redirects.virgin-atlantic.com.conf > /opt/ADOC/users/agdadmin/test/shazin/olist
cp olist redirects.virgin-atlantic.com.conf
echo "Pattern deleted"
else
echo "Pattern does not exist in redirects.virgin-atlantic.com.conf"
fi

but while executing I am getting the below error:

./redirects.sh[17]: [grep: not found

Please can anyone assist.

Regards,
Shazin

Check for the whitespacing in script. There are innumerable number of scripts in the forum, try searching for them.

Command test [] expects values, not commands, try this:

if [ `grep $value redirects.virgin-atlantic.com.conf > dred1` && $? == 0] ; then