Search results
Results from the WOW.Com Content Network
grep is a command-line utility for searching plaintext datasets for lines that match a regular expression. Its name comes from the ed command g/re/p (global regular expression search and print), which has the same effect.
FINDSTR flags strings [drive:][path]filename[...] Arguments: flags This can be any combination of flags described below. strings Text to be searched for. [drive:][path]filename Specifies a file or files to search. Flags: /B Matches pattern if at the beginning of a line. /E Matches pattern if at the end of a line. /L Uses search strings literally.
The command has a number of switches: a - number all lines; t - number lines with printable text only; n - no line numbering; string - number only those lines containing the regular expression defined in the string supplied.
He later added this capability to the Unix editor ed, which eventually led to the popular search tool grep's use of regular expressions ("grep" is a word derived from the command for regular expression searching in the ed editor: g/re/p meaning "Global search for Regular Expression and Print matching lines"). [15]
The classic filter in Unix is Ken Thompson's grep, which Doug McIlroy cites as what "ingrained the tools outlook irrevocably" in the operating system, with later tools imitating it. [1] grep at its simplest prints any lines containing a character string to its output. The following is an example:
/V Displays all lines NOT containing the specified string. /C Displays only the count of lines containing the string. /N Displays line numbers with the displayed lines. /I Ignores the case of characters when searching for the string. Note: If a pathname is not specified, FIND searches the text typed at the prompt or piped from another command.
getopt — Parse command line options and parameters. grep — Show lines matching regular expressions. groups — Print the groups a user is in. gunzip — Decompress gz files. halt — Restart, halt or powerdown the system. head — Copy first lines from files to stdout. help — Show usage information for toybox commands. hexedit ...
but in general using -0 with -print0 should be preferred, since newlines in filenames are still a problem. GNU parallel is an alternative to xargs that is designed to have the same options, but is line-oriented. Thus, using GNU Parallel instead, the above would work as expected. [7]