Greep could be a command-line utility for looking out plain-text datasets for lines matching an everyday expression. Grep was originally developed for the operating system software system by Ken Thompson, however, is out there these days for all Unix-like systems. Its name comes from the disfunction command g/re/p (globally search an everyday expression and print), that has an equivalent effect: doing a worldwide search with the regular expression and printing all matching lines.
Find Syntax:
grep “literal_string” file name.
Syntax: grep “literal_string” file name
Example: $ grep “this” demo_file
Syntax: grep “string” FILE_PATTERN.
Example: $ grep “this” demo_*
Syntax: grep-i “string” FILE.
Example: $ grep -i “the” demo_file.
Syntax: grep “lines.*empty” demo_file
Example: grep -iw “is” demo_file
Syntax: grep -A <N> “string” FILENAME.
Example: grep -A 3 -i “example” demo_text
Syntax: grep -B <N> “string” FILENAME.
Example: grep -B 2 “single WORD” demo_text.
Syntax: grep -c <N> “string” FILENAME.
Example: grep -C 2 “Example” demo_text.
Example: grep -r “ramesh” *
Example: grep -v “go” demo_text.
Syntax: grep -c “pattern” filename.
Example: grep -c “go” demo_text.
Example: grep -I this demo_*
Syntax: grep -o -b “pattern” file.
Example: grep -o -b “3” temp-file.txt.
o = match only string
b = show position
Syntax: grep -n “go” demo_txt.
These are the 14 best examples for grep command in Unix.
Learn how to move wordpress from localhost to live server: export XAMPP files and database,…
Learn what happens when a domain expires, how grace and redemption periods work, what recovery…
Compare HostLelo alternatives for Indian websites on renewal price, panels, email, SSL, backups, UPI payments…
Compare wix vs wordpress for Indian small businesses: 3-year rupee cost, beginner ease, UPI/Razorpay payments,…
Learn how to transfer domain to another registrar: check the 60-day rule, unlock it, use…
Learn how to create a directadmin backup, download it off-server, and restore website files, databases,…
This website uses cookies.