ALERT

[FREE DEMO] Deploy Your Enterprise Cloud in Minutes

Global-Regular-Expression-Print (GREP)

Definition - What does Global-Regular-Expression-Print (GREP) mean?

Global regular expression and print (GREP) is a command line text search utility used in Unix. The "grep" command searches files or standard input for lines that match a given regular expression. It then prints the matching lines to the program’s standard output.

Techopedia explains Global-Regular-Expression-Print (GREP)

The grep command allows a user to search one or more files for lines that contain a pattern.

A general example of the grep command format is "grep sat check.txt". This command prints all lines containing the text string "sat", regardless of word boundaries, from the file check.txt. For instance, if there are lines that contain text strings such as "fisat", "sat", "saturn", etc., all would be printed at the output terminal.

There are a variety of options used along with grep to display the output based on the requirement. A few of these options are:

  • "-i" - Ignore case sensitivity
  • "-b" - Display block number at beginning of every line
  • "-l" - Display file names but not matched lines
  • "-n" - Display matched lines and line numbers
  • "-v" - Display lines that do not match

Variations of grep are available for many operating systems. Early variations of grep included the "egrep" and "fgrep" commands. Egrep searches a file for a pattern using regular expression syntax, fgrep searches for a fixed character string. These variants of grep are included in most modern grep implementations as command-line switches. Other commands contain the word "grep" to indicate that they are search utilities. The "pgrep" utility, for example, displays a list of process names that match a specified regular expression.

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
Tweat cdn.techopedia.com
"Techopedia" on Twitter


'@Techopedia'
Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Resources
The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.