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:
3605
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:
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
Move or Rename file and directories - mv
Sort Numeric file
Shell script that prints names of all sub-directories present in the current directory
Wild cards and examples in unix
Changing current directory - cd
Shell script to display the name of those files (in the given directory) which are having multiple links
Show current directory - pwd
Count no.of words in file abc?
Shell script which whenever gets executed displays the message “Good Morning/Good afternoon /Good Evening “depending on the time it get executed"
Compress and expand data - compress / uncompress
Rename a file from first1.txt to first2.txt
Shell script to check whether inputted directory is in current directory or not
Word Navigation in unix
Write a shell script to sort the given numbers in descending order using Bubble sort
Suppose four filenames are supplied then the first file should get copied into second file, the third file should get copied into four
Shell Script to display the exit status using grep command which search a string from a string
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
How to change permission of file as 644?
Write a script to count and report the number of entries in each subdirectory mentioned in the path, which is supplied as a command-line argument
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