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.
How to Create Your Own Cryptocurrency Step By Step What is Cryptocurrency? Cryptocurrency is basically…
Web Hosting Diwali Offer HostKarle Coupon Code 2021 Hostkarle provides cheap web hosting services…
Some files not permitted by wordpress to upload When we upload that files wordpress showing…
In this tutorial, you will learn how to set up or enable Cron jobs in…
Hostkarle provides cheap web hosting service in India also have rated no.1 web hosting…
Best Trick To Secure Wordpress Site From Hackers You can try our trick to…
This website uses cookies.