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:
3603
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:
Write a shell program to concatenate the contents of 2 files
Write a shell script, which displays a list of all files in the current directory to which you have read, write and execute permissions
Add a new user login to the system - useradd
Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links
Write a shell script, which reports names and sizes of all files in a directory whose size is exceeding 1000 bytes
Shell script which receives two file names as arguments and checks whether the two file contents are same or not. If same then delete second file
Shell Script to find out the sum of the given numbers using command line argument
Different types of Error in unix
Script to find the value of one number raised to the power of another
Compress and expand data - compress / uncompress
Write a shell script to reverse a number supplied by a user.
Write a shell script to convert a file to lower case or upper case as specified by user.
Change file owner of group - chown
Split a large file into small files
Write a shell script to find the largest among the 3 given numbers
Program to perform all ADDITION on two operands : (decimal, binary, octal,hexadecimal)
How would we see content of the file?
Wild cards and examples in unix
Calculate the gross salary
Shell script to perform operations like display, list, make directory and copy, rename, delete, edit file
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