I need to search a string in the file like
**abc.def., *
My input file looks like
mn.*, \
gh.*, \
pqrs.* \
fgh.* \
zcv.* \
rp.* \
My output has to be appended if the search string is not present in the file it has to be appended in the file like
mn.*, \
gh.*, \
abc.def.*, \
pqrs.* \
fgh.* \
zcv.* \
rp.* \
How do i do it in the shell script. I am able to search with grep with pattern but not able to add the line. Any quick suggestions would help me Below is my command
grep -q -F "abc.def.*, \" filename
echo $?