December 1999
Beginner
528 pages
11h 10m
English
The general format is:
grep [options] basic regular expression [file]
where basic regular expression can be a string.
When you supply a string in a grep command it is good form to enclose it with double quotes. Like this: "mystring". There are two reasons for this. It stops the shell from misintepreting them as something else. Secondly, you may want to search for a string that contains a couple of words, like this: "jet plane". If you don’t surround the string with quotes it will think the word ‘plane’ is a file, and you’ll get error messages about non-existent files.
You should also use double quotes when using variables, like this: grep "$MYVAR" filename, if you do not you will get no data returned.
Use single ...
Read now
Unlock full access