Searching a pattern in file and deleting th ewhole line containing the pattern

Hi All,

Please can someone assist in the script I have made that searches a pattern in a file and delete the whole line containing the pattern.

#!bin/sh

# The pattern that user want to add to the files

echo "Enter the pattern of the redirect"
read value

# check if the user has provided a valid pattern

if [-z "$value"] ; then
echo "You have not entered the pattern" ; exit 1

# If a pattern is entered by the User
# Searches the pattern and deletes the pattern if present in file (file 1) <filename 1>

mkdir /path/dred1
elif [grep "$value" <filename 1> > /path/dred1 && $? == 0] ; then
rm -r /path/dred1
echo "Pattern exist in <filename 1>"
sleep 1000
mkdir /path/olist
sed '/"$value"/d' <filename 1> > /path/olist
/path/olist > <filename 1>
rm -r /path/olist
echo "Pattern deleted"
else
rm -r /path/dred1
echo "Pattern does not exist in <filename 1>"
fi
fi

---------- Post updated at 08:47 PM ---------- Previous update was at 08:41 PM ----------

Here value is the pattern that requires to be searched and <filename 1> is the name of the file in which the pattern has to be searched. olist and dred1 are the temperory directories that I am creating and then deleting after use.

Please can anyone advise.

Cheers,
Shazin

Edit the file in place:

#!/bin/sh

ed -s /input_file <<EOF
g/search_term/d
w
q
EOF