grep command examples in Unix and Linux
grep command is one of the most frequently used UNIX command stands for "Global Regular Expression Print" like find command, chmod command or tar command in Unix. grep command in Unix operating system e.g. Linux, Solaris, BSD, Ubuntu or IBM AIX is used to search files with matching patterns, by using grep command in Unix you can search a file which contains a particular word or particular pattern. UNIX grep command also provides several useful command line option which can be used to enhance functionality of grep command e.g. by using grep -v you can list down all files which doesn't contains a word i.e. excluding files which matches a pattern, grep -c will print count of matching pattern in a file etc. One of the popular example of grep command is to find empty files and directories in Unix. This grep command tutorial is not about theory of UNIX grep but practical use of grep command in UNIX and here I am sharing my experience on use of grep command in Linux with an aim that this would serve as quick guide or tutorial for using grep in UNIX for new beginners and help them to understand the grep command better and its thoughtful usage in UNIX or Linux. Many people use grep just for finding words in a file and missed the real potential of grep by not using all its powerful command line options and its regular expression capability which could not only save a lot of time but also works as a great and powerful tool while analyzing large set of data or log files. Also find command in UNIX can be used in place of grep at many places.
grep command is one of the most frequently used UNIX command stands for "Global Regular Expression Print" like find command, chmod command or tar command in Unix. grep command in Unix operating system e.g. Linux, Solaris, BSD, Ubuntu or IBM AIX is used to search files with matching patterns, by using grep command in Unix you can search a file which contains a particular word or particular pattern. UNIX grep command also provides several useful command line option which can be used to enhance functionality of grep command e.g. by using grep -v you can list down all files which doesn't contains a word i.e. excluding files which matches a pattern, grep -c will print count of matching pattern in a file etc. One of the popular example of grep command is to find empty files and directories in Unix. This grep command tutorial is not about theory of UNIX grep but practical use of grep command in UNIX and here I am sharing my experience on use of grep command in Linux with an aim that this would serve as quick guide or tutorial for using grep in UNIX for new beginners and help them to understand the grep command better and its thoughtful usage in UNIX or Linux. Many people use grep just for finding words in a file and missed the real potential of grep by not using all its powerful command line options and its regular expression capability which could not only save a lot of time but also works as a great and powerful tool while analyzing large set of data or log files. Also find command in UNIX can be used in place of grep at many places.