Welcome -
Guest!
Login
/
Register Now
|
Search:
Home
Articles
Forum
Interview FAQ
Activities
News
Videos
Poll
Links
People
Groups
Unix / Linux / Ubuntu Articles
Submit Article
Home
»
Articles
»
Unix / Linux / Ubuntu
»
Commands
RSS Feeds
Search a file for a pattern - grep
Posted By:
Jarvia Miller
Category:
Unix / Linux / Ubuntu
Views:
3702
This article explains about grep command with an example in unix.
grep command is used to search a file for a pattern in unix.
Syntax of grep Command
grep [- options] pattern filename
Example of grep command
grep "hello" helloFile.txt
helloFile.txt file contents are as shown below
hello world
Share:
Previous Post:
Move or Rename file and directories - mv
Next Post:
Update access, modification, and / or change times of file - touch
Didn't find what you were looking for? Find more on
Search a file for a pattern - grep
Or get
search suggestion and latest updates
.
Jarvia Miller
author of Search a file for a pattern - grep is from Frankfurt,
Germany
.
View All Articles
Related Articles and Code:
PROGRAM TO DISPLAY THE PATTERN OF NUMBERS IN REVERSE PATTERN
Program to search an element in an array using Linear search or Sequential Search
Shell Script to display the exit status using grep command which search a string from a string
programs uses two input files and produces output using binary search on criteria fields
Program uses two input files and produces output using binary search on criteria fields
PROGRAM TO SEARCH THE RECORDS FROM FILE
Program that performs add, edit, delete, display and search date from file
PROGRAM to Search Occurances of Charaters from File in Parallel
Program to find files with duplicate names using binary search tree
Defines and differentiates sequential search and binary search
Algorithms of sequential search and binary search
Program to search an element in an array using Binary search
Program to search an element in an array using Linear search
Program to search an element in an array using Linear Search
Program to print number triangle in reverse pattern
Program to print triangle of numbers in reverse pattern
Program to print pyramid of * (starts) in reverse pattern
Program to print pyramid of abcd in reverse pattern
Program to print triangle of * stars in reverse pattern
Program to print triangle in opposite pattern
Other Interesting Articles in Unix / Linux / Ubuntu:
Rename a file from first1.txt to first2.txt
Write a shell program to convert all the contents into the uppercase in a particular file
Give example of cut command?
Compress and expand data - compress / uncompress
Unix Commands and description of ls,logout,mkdir,rmdir,rm,cd,man,talk,write,pico,pine,more,sz,rz,telnel,ftp,archie,irc,lynx,gopher,tin,trn,passwd etc
How would u get today’s date?
Write a shell program to concatenate the contents of 2 files
Write a shell program to exchange the values of two variables
Program to count length of user input string
Report process status - ps
Concatenate, copy, print files - cat
Write a script to find the value of one number raised to the power of another
Print user and group IDs and names - id
Change a permission of a file
How would you know name of the users who are login?
Display content of a file - more
Changing current directory - cd
Program to calculate the factorial of a number
How to find out common lines between two files?
Write a shell script to find the sum, the average and the product of the four integers entered
Please enter your Comment
*
*
Comment should be atleast 30 Characters.
Please put code inside [Code] your code [/Code].
Please login to post comment
No Comment Found, Be the First to post comment!
Unix / Linux / Ubuntu
View All
Advance
Basics
Commands
Homework Help
Interview FAQ
Terms and Terminology
Assembly Language
Artificial Intelligence
C Programming
C++ Programming
Visual C++
OOAD
Cobol
Java
SQL Server
Asp.net MVC
Rest and WCF Services
Entity Framework
Knockout.Js
Networking
OOPs Concept
HTML
Dos
SQL
System Analysis & Design
Gadgets
Internet
CSS
Javascript
.Net Framework
Asp.net
C#
VB.Net
Python
Perl
Oracle
Software Engineering
RDBMS Terms
AJAX Framework
Design Pattern
UML
WPF
WCF
SEO
PowerShell
Visual Studio
WWF
BizTalk Server
Azure
General
Testing
Online Certifications
PHP
My SQL
LinQ
Project Management
Silverlight
XML
MS Office
Windows OS
DHTML
Sharepoint