I want to use grep
in an If statement to search for a first-name and last-name within a text file. I can't seem to make it work on my own.
if [[ grep -E "$first|$last" Datafile.txt ]]
then
echo "This name already exists"
else
echo "This name doesn't exist yet"
fi
Any suggestions??
more simpler way. make a new file that will contain your search key-word, one per line.
You don't need
[[
operator, just: