Browse Definitions :
Definition

grep

Grep, a UNIX command and also a utility available for Windows and other operating systems, is used to search one or more files for a given character string or pattern and, if desired, replace the character string with another one. For example, a UNIX system user can enter on a command line:

grep html homepage.htm

html specifies the character string to search for on each line. homepage.htm specifies the file to search. The result would be to display any line in the homepage.htm file that includes the character string html. The entire line is displayed.

grep can be used simply as a way of searching, especially through multiple files. (In the above command, we could have specified additional files besides homepage.htm.) It can also be used to search for word or string occurrences that need to be replaced. If you are not sure exactly what the effect might be of making the replacement, grep identifies the lines and you can decide what further action to take for each occurrence. grep can also be used as the first step in an automatic procedure to search and replace a word or phrase. The output from grep can be the input (perhaps using the UNIX pipe symbol) for a replacement command.

grep allows the string argument to be specified as a regular expression, which is a way of specifying a string that allows certain metacharacters (special keyboard characters such as the period) to stand for other characters or to further define the way the pattern-matching should work. For example:

grep ".*hood" essay1

would search the essay1 file and display every line containing a word with the string hood. The period (dot) indicates that any character may precede the string hood and the asterisk (*) says that any number of the "any characters" indicated by the dot can precede the string. (The quote marks around the string argument in this example are optional, but quotes are required where the argument is a phrase or contains a blank.)

grep originated from a UNIX text editor that provided a command sequence g/re/p for global/regular expression/print.

This was last updated in September 2005

Continue Reading About grep

SearchCompliance

  • information governance

    Information governance is a holistic approach to managing corporate information by implementing processes, roles, controls and ...

  • enterprise document management (EDM)

    Enterprise document management (EDM) is a strategy for overseeing an organization's paper and electronic documents so they can be...

  • risk assessment

    Risk assessment is the identification of hazards that could negatively impact an organization's ability to conduct business.

SearchSecurity

  • honeypot (computing)

    A honeypot is a network-attached system set up as a decoy to lure cyber attackers and detect, deflect and study hacking attempts ...

  • spam trap

    A spam trap is an email address that is used to identify and monitor spam email.

  • cracker

    A cracker is someone who breaks into someone else's computer system, often on a network; bypasses passwords or licenses in ...

SearchHealthIT

SearchDisasterRecovery

  • risk mitigation

    Risk mitigation is a strategy to prepare for and lessen the effects of threats faced by a business.

  • call tree

    A call tree is a layered hierarchical communication model that is used to notify specific individuals of an event and coordinate ...

  • Disaster Recovery as a Service (DRaaS)

    Disaster recovery as a service (DRaaS) is the replication and hosting of physical or virtual servers by a third party to provide ...

SearchStorage

  • storage virtualization

    Storage virtualization is the pooling of physical storage from multiple storage devices into what appears to be a single storage ...

  • erasure coding

    Erasure coding (EC) is a method of data protection in which data is broken into fragments, expanded and encoded with redundant ...

  • continuous data protection

    Continuous data protection (CDP), also known as continuous backup, is a backup and recovery storage system in which all the data ...

Close