![]() The + sign is optional for example, -r means the same thing as -r+. Each individual character is a switch that you can turn on or off: a plus symbol + after a character turns the option on, a hyphen - after the character turns the option off. You can pass options to the GREP utility on the command line by specifying one or more single characters preceded by a hyphen. ![]() To display a list of the GREP command-line options, special characters, and defaults for GREP, enter: This lets you use pipes (vertical bars |) and redirection ("greater than" symbol >). If you do not specify a file, GREP searches the standard input. If you list files without a path, GREP searches the current directory. In addition, you can type a path (drive and directory information). Files can be an explicit file name or a generic file name incorporating the ? and * wildcards. The general command-line syntax for GREP isĬonsists of one or more letters, preceded by a hyphen -, which changes the behavior of GREP. (See The Search String section in this topic.) You can make GREP search for any string that matches a particular pattern. GREP can do a lot more than match a single, fixed string. Because GREP does not ignore case by default, the strings bob and boB do not match. GREP responds with a list of the lines in each file (if any) that contained the string Bob. Suppose you wanted to find out which text files in your current directory contained the string Bob. Here is a quick example of a situation where you might want to use GREP. 4.1 Example 1 - Redirecting Output from GREP.
0 Comments
Leave a Reply. |