![]() |
Chapter 3 | ![]() |
Unix is, traditionally, a command-line based program and grep follows this tradition. Lucky for us, the most common uses of grep are pretty simple. The syntax for grep is:
grep [options] PATTERN [files or directories]
Let's cover the options that you'll be using;
> grep -n Xap asciiobjs.patch 122: /* This variable determines if Xapobjs are on or off */ > |
This would then display every line with the word "Xap" in it, with the line number in the front - and
like all things Unix, it is case sensitive. i.e.
If you are used to regular expressions, you may also use those in the pattern argument instead. These get difficult very quickly, and if you're using extended regular expressions you may wish to use egrep (or just use the -E option) which will make sure you get what you are really asking for. We will not cover regular expressions here.
![]() |
Index | ![]() |
4.1 Windows Uses Find | 4.3 Tracing the Thread of Execution |