Answers for "shell check if string in file"

1

linux test if string exists in file

if grep -Fxq "string" file.txt; then 
	echo "Match"
else 
	echo "No match"
fi
Posted by: Guest on January-28-2021
0

bash if file contains string

if grep -q SomeString "$File"; then
  Some Actions # SomeString was found
fi
Posted by: Guest on March-24-2020

Code answers related to "shell check if string in file"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language