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

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

File Extensions and File Formats

SearchCompliance

  • PCI DSS (Payment Card Industry Data Security Standard)

    The Payment Card Industry Data Security Standard (PCI DSS) is a widely accepted set of policies and procedures intended to ...

  • risk management

    Risk management is the process of identifying, assessing and controlling threats to an organization's capital and earnings.

  • compliance framework

    A compliance framework is a structured set of guidelines that details an organization's processes for maintaining accordance with...

SearchSecurity

  • Trojan horse (computing)

    In computing, a Trojan horse is a program downloaded and installed on a computer that appears harmless, but is, in fact, ...

  • identity theft

    Identity theft, also known as identity fraud, is a crime in which an imposter obtains key pieces of personally identifiable ...

  • DNS over HTTPS (DoH)

    DNS over HTTPS (DoH) is a relatively new protocol that encrypts domain name system traffic by passing DNS queries through a ...

SearchHealthIT

  • telemedicine (telehealth)

    Telemedicine is the remote delivery of healthcare services, such as health assessments or consultations, over the ...

  • Project Nightingale

    Project Nightingale is a controversial partnership between Google and Ascension, the second largest health system in the United ...

  • medical practice management (MPM) software

    Medical practice management (MPM) software is a collection of computerized services used by healthcare professionals and ...

SearchDisasterRecovery

SearchStorage

  • M.2 SSD

    An M.2 SSD is a solid-state drive (SSD) that conforms to a computer industry specification and is used in internally mounted ...

  • kilobyte (KB or Kbyte)

    A kilobyte (KB or Kbyte) is a unit of measurement for computer memory or data storage used by mathematics and computer science ...

  • virtual memory

    Virtual memory is a memory management capability of an operating system (OS) that uses hardware and software to allow a computer ...

Close