Searching files using regular expressions There are three basic UNIX commands that deal, in some form or another with text processing. Sed builds upon the functionality of grep adding primative conditionals and switch statements, and awk builds upon sed to add variables, subroutines, loops and other expressions. Both sed and awk can manipulate the text as well as display it, while grep is limited to display only. For the purposes of this tutorial, only grep will be discussed. This searches the named files and prints each line that contains at least one instance of the pattern.
Upper case remains unmodified.
Patterns are a type of string call a regular expression. This matches whatever the unadorned expression would match, but saves the string matched by the expression in a numbered buffer. To do this, you need to use the tar command. Example 2 does the same thing as example 1, but redirects the output to the file mydata.tar instead of the default device. Finally, example 3 extracts all the files from the archive mydata.tar.