Sponsored Content
Top Forums Shell Programming and Scripting Shell script to search a pattern in a directory and output number of find counts Post 302682801 by vivignesh on Tuesday 7th of August 2012 01:55:32 AM
Old 08-07-2012
Shell script to search a pattern in a directory 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
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to search through numbers and print the output

Suppose u have a file like 1 30 ABCSAAHSNJQJALBALMKAANKAMLAMALK 4562676268836826826868268468368282972982 2863923792102370179372012792701739729291 31 60... (8 Replies)
Discussion started by: cdfd123
8 Replies

2. Shell Programming and Scripting

shell script to search content of file with timestamps in the directory

hello, i want to make a script to search the file contents in my home directory by a given date and output me the line that has the date... (10 Replies)
Discussion started by: psychobeauty
10 Replies

3. Shell Programming and Scripting

Help me to find files in a shell script with any matching pattern

Hi friends.. I have many dirs in my working directory. Every dir have thousands of files (.jsp, .java, .xml..., etc). So I am working with an script to find every file recursively within those directories and subdirectories ending with .jsp or .java which contains inside of it, the the pattern... (3 Replies)
Discussion started by: hnux
3 Replies

4. UNIX for Dummies Questions & Answers

find Search - Find files not matching a pattern

Hello all, this is my first and probably not my last question around here. I do hope you can help or at least point me in the right direction. My question is as follows, I need to find files and possible folders which are not owner = AAA group = BBB with a said location and all sub folders ... (7 Replies)
Discussion started by: kilobyter
7 Replies

5. Shell Programming and Scripting

Shell script to find if any new entry in directory

I require a shell script to find if any new entry of dump files present in a particular directory and to send an email if any new entry exists.I had a crontab to run the script for every 5 min. Below are the file names.dump.20150327.152407.12058630.0002.phd.gz... (9 Replies)
Discussion started by: bhas85
9 Replies

6. Shell Programming and Scripting

UNIX Shell Script Help for pattern search

Hi Need help for below coding scenario. I have a file with say 4 lines as below. DEFINE JOB TPT_LOAD_INTO_EMP_DET ( TDPID = @TPT_TDSERVER , USERNAME = @TPT_TDUSER ) ; ( 'DROP TABLE '||@TPT_WRKDB ||'.LOG_'||@TPT_TGT ||' ; ') , SELECT * FROM OPERATOR (FILE_READER) ; ) ; Now I want to... (5 Replies)
Discussion started by: Santanu2015
5 Replies

7. Shell Programming and Scripting

Output counts of all matching strings lessthan a number using awk

The awk below is supposed to count all the matching $5 strings and count how many $7 values is less than 20. I don't think I need the portion in bold as I do not need any decimal point or format, but can not seem to get the correct counts. Thank you :). file chr5 77316500 77316628 ... (6 Replies)
Discussion started by: cmccabe
6 Replies

8. UNIX for Beginners Questions & Answers

How to zip csv files having specific pattern in a directory using UNIX shell script?

I have files in a Linux directory . Some of the file is listed below -rw-rw-r--. 1 roots roots 0 Dec 23 02:17 zzz_123_00000_A_1.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_121_00000_A_2.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_124_00000_A_3.csv drwxrwxr-x. 2 roots roots 6 Dec 23... (4 Replies)
Discussion started by: Balraj
4 Replies

9. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

10. Shell Programming and Scripting

Script to find string based on pattern and search for its corresponding rows in column

Experts, Need your support for this awk script. we have only one input file, all these column 1 and column 2 are in same file and have to do lookup for values in one file(column1 and column2) but output we need in another file Need to grep row whose string contains 9K from column 1. When found... (6 Replies)
Discussion started by: as7951
6 Replies
DIRDIFF(1)						      General Commands Manual							DIRDIFF(1)

NAME
dirdiff - display differences and merge changes between directory trees SYNOPSIS
dirdiff [-a|--all] [-o|--only pattern] [-I|--ignore pattern] [-r|--rcs] [-t|--bktag] [-c|--context num] [-b] [-w] [-B] [-i] [-d] [-S] [-k] dir1 dir2 ... OPTIONS
-a,--all Don't exclude any files. -o,--only pattern Only process files matching pattern. -I,--ignore pattern Don't process files matching pattern. -r,--rcs Ignore differences in RCS strings. -t,--bktag Ignore differences in Bitkeeper strings. -c,--context num Set number of lines of context to show. -b,-w,-B,-i,-d Pass these on to diff. -S Show files that are the same in the file list. -K Enable bitkeeper support. DESCRIPTION
Dirdiff is a graphical tool for displaying the differences between directory trees (up to 5) and for merging changes from one tree into another. At startup, dirdiff displays a main window with a list of the files that are different between the trees. Colored squares are used to indicate the relative ages of the versions. Files are like leaves on a deciduous tree: the newest ones are green, and then they turn yel- low, orange, and red as they get older. Missing files are black, and directories are white. To see the differences between two versions of a file, double-click on the file name. By default, the first and last versions are com- pared, but this can be changed using the Diff menu in the main window. In the differences window, there are checkboxes to the left of all the sections which are different. You can use button 1 to select an individual checkbox, or shift-button 1 or button 3 to select a whole group. Selecting a line means that you are asking for that change to be made when you update either of the files using the Merge menu. The line will be removed if it is already present or added if it is not present. To copy from one tree to another, click on the file name and select the appropriate copy operation from the Copy menu of the main window. Selecting Make patch from the File menu of the main window produces a file describing the changes between the files that can be applied by the patch tool. You can edit the patch before saving, and may wish to add explanatory text, instructions, or patch Prereq lines at the beginning. To save the patch, enter a filename in the patch window relative to the current directory, and choose Save. This will also close the window. If you are sending out patches, then the from directory should be the original version of the source. Try to make sure that the two files have the same number of leading directories. See the patch(1) man page for more information. NOTES
Dirdiff needs to be able to load the libfilecmp.so.0.0 shared library for the -r or -t flags to work. SEE ALSO
diff(1) patch(1) AUTHOR
Paul Mackerras May 2002 DIRDIFF(1)
All times are GMT -4. The time now is 07:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy