Answers for "get string from file if exists"

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
-1

check if string in file

if grep -Fxq "pattern_to_search" file.txt; then #check if pattern string in file
  #do something
fi
Posted by: Guest on November-02-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language