LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-07-2012, 12:59 AM   #1
vivignesh
LQ Newbie
 
Registered: Jul 2010
Posts: 18

Rep: Reputation: 0
shell script to search a pattern in a diretory and output number of find counts


I need a Shell script which take two inputs which are
1) main directory where it has to search and
2) pattern to search within main directory all files (.c and .h files)
It has to print number of pattern found in main directory & each sub directory.
main dir --> Total pattern found = 5
|
sub dir --> 3
|
sub dir --> 2
 
Old 08-07-2012, 01:14 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hello,

You'll have a hard time finding someone here on LQ that will do your work for you. Show us what you've got and where it's failing and we'll point you in the right direction. Good starting points are:
Bash Guide for Beginners
Advanced Bash Scripting Guide

Kind regards,

Eric
 
  


Reply

Tags
pattern, search, shell script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to search file by pattern and then delete corresponding lines in shell cyatomato Programming 8 09-17-2010 08:08 AM
Pattern search question in shell shogun1234 Linux - Newbie 10 10-10-2009 09:17 AM
how to find given number is integer or not in shell script kvmreddy Linux - Newbie 2 08-15-2009 08:05 AM
how to find a pattern using shell script sharad Linux - General 1 05-23-2006 03:50 AM
pattern search through find command. abhi Linux - Newbie 2 04-11-2005 10:31 AM


All times are GMT -5. The time now is 09:20 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration