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:
3689
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:
Moving the text in unix
Change file mode access permission - chmod
Which command given information of present working directory?
Find all lines in a file with words longer than 4 characters, assuming that words are separated by spaces except at the beginning or end of line
Shell script which whenever gets executed displays the message “Good Morning/Good afternoon /Good Evening “depending on the time it get executed"
Append abc.txt, xyz .txt
Write a shell script to find the largest among the 3 given numbers
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
Write a shell program to convert all the contents into the uppercase in a particular file
Program to perform all SUBTRACTION on two operands : (decimal, binary, octal,hexadecimal)
Write a Script to Broadcast a message to a specified user when the user loged on any terminal
Write a shell script to convert a file to lower case or upper case as specified by user.
Count no.of lines in file abc?
Shell Script for generating a mark sheet
Write a shell program to concatinate two strings and find the length of the resultant string
Input mode command in unix
Sort file abc.txt and save this sorted file in xyz.txt
Shell Script to find out the sum of the given numbers using command line argument
Changing current directory - cd
Display file in column format
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