Most people imagine that system administrators and programmers fiddle with knobs and diodes. Their goal? To reach into the virtual reality of the Internet, gathering the binary forces of code into the applications and infrastructure we all use today. Most people would be disappointed to learn that sysadmins and code monkeys more often poke at streams of text in hopes of getting the right response.
If you are a sysadmin or programmer and find yourself obsessively dipping into streams of text on a POSIX system, then you have probably either encountered grep or come across a time you wished you could use this command.
Its quite easy to make use of the grep command in your Linux- or UNIX-based system. As you might already have an idea that for using this command, you need to open the terminal on your system.
Now to use the grep command, the first thing you need to do is to understand its syntax, which is as follows:
grep [OPTION] PATTERNS [FILE]
- OPTIONS - Defines the way the grep will behave while searching for a text or string.
- PATTERNS - The text pattern or the regular expressions that need to be searched.
- FILE - It specifies one or more files in which the pattern will be searched.