Answers for "bash if file contains string"

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
1

bash check if string in file

Just use grep with flags 'F' (fixed string), 'x' (exact match) and 'q'
(quiet output) in order to check if a word string is in a file
if grep -Fxq "string" file.txt; then #do some code...#; fi
Posted by: Guest on November-11-2020

Code answers related to "bash if file contains string"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language