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:
3588
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:
Sort file abc.txt and save this sorted file in xyz.txt
Overview of UNIX
Write a shell program to exchange the values of two variables
Write a shell script, which displays a list of all files in the current directory to which you have read, write and execute permissions
Tee examples in unix
Write s shell script, which will receive any number of filenames as arguments. The shell script should check whether every argument is a file or a dir
Append abc.txt, xyz .txt
Program to convert and print this distance in meters, feet, inches and centimeters
How would you display the calendar of 2007?
Shell Script to delete the zero sized file using if and for
Prepare a menu driven calculator
Find all lines in a file with words longer than 4 characters, assuming that words are separated by spaces except at the begining or end of line
Write a shell program to exchange the values of two variables
Count no.of lines in file abc?
Sort Numeric file
Program to calculate the sum of its digits
Shell script which would Receive the log name during execution ,obtain information about it from /etc/passswd and display this information on screen
Script to count and report the number of entries present in each subdirectory mentioned in the path, which is supplied as a command-line argument
Write a shell program to count the characters, count the lines and the words in a particular file
How to find out difference between two files?
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