Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
grep -v 'read' fruits.txt
yellow bananas
green apples

Have grep tell you if it found a match in the file,

Code Block
languagebash
grep "diddle" -q fruits.txt && echo "FOUND" || echo "NOPE"
NOPE
grep "apples" -q fruits.txt && echo "FOUND" || echo "NOPE"
FOUND
Warning

Look up if time permits how to do this using quotes to handle spaces or special characters....

Hmm, maybe all I need to do is escape any special characters and spaces probably work as is.