Sponsored Content
Top Forums Shell Programming and Scripting Finding directories with expression Post 302768077 by lxdorney on Friday 8th of February 2013 02:26:05 AM
Old 02-08-2013
Finding directories with expression

Hi All,

I need your help in finding pattern of directories.

need to search for all pattern have "mypatern" from base directory folder.

example
-------

server1 - base directory

100 server1/ab_123456_1/mypattern
100 server1/ab_123456_2/mypattern
200 server1/ab_123457_1/mypattern
400 server1/ab_123457_3/mypattern

If the pattern "mypattern" is found in server1/ab_123456_1 and if another pattern is found ab_123456_2 then i want the to du -k mypattern and sum and the result saved as shown.

result.txt
---------
200k 123456/mypattern
600k 123457/mypattern

Appreciate your help in Advance.

Thanks
lxdorney
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

finding directories in UNIX

I am accessing a UNIX server via FTP. I want to retieve a file in a directory. What is the UNIX command that I need to view and retrieve files from a directory? (1 Reply)
Discussion started by: yodaddy
1 Replies

2. Shell Programming and Scripting

Expression for Finding Multiple Directories..??

I am writing a shell script to search for previous versions of an application...the application is called TAU and basically i want to search the users home directory and /Applications for any instances of a "TAU" folder.. If found i want to give the user the option to remove the old folders and if... (3 Replies)
Discussion started by: meskue
3 Replies

3. UNIX for Dummies Questions & Answers

Create directories with regular expression

Hi guys, can any one tell me how to create directories using regular expression? Let's say that I need to create directories test01, test02, test03.... test10. Can it be done using any regular expression? thanks. (13 Replies)
Discussion started by: mahendrt
13 Replies

4. Shell Programming and Scripting

finding correct directories

I have directories like V00R01,V00R02,V01R01,V01R02 in a directory where V is version and R is a release. basically I need to set base directory and current directory. Under a version there can be any number of releases and there can be number of versions also. V00R01...V00R50..so on also,... (2 Replies)
Discussion started by: vjasai
2 Replies

5. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

6. UNIX for Dummies Questions & Answers

using regular expression for directories in find command

Hi, I want to find the files available in a directory /var/user/*/*/data/. I tried using the command "find /var/user/ -path '*/*/data/ -name '*' -type f" it says find: 0652-017 -path is not a valid option and then i tried using "find /var/user/ -name '*/*/data/*' -type f" but its not... (3 Replies)
Discussion started by: vinothbabu12
3 Replies

7. UNIX for Dummies Questions & Answers

Finding size of all directories

Alright so I've tried a couple different things that at first glance, looked like they worked. find . -maxdepth 5 -type d -daystart -mtime 1 | xargs du -h Which seems to ignore the previous commands such as depth and modified time. find .. -maxdepth 2 -type d -daystart -ctime 1 | xargs... (8 Replies)
Discussion started by: Aussiemick
8 Replies

8. UNIX for Dummies Questions & Answers

Finding multiply directories

I have multiply directories scattered throughout my system that end in 2011. Example: one_2011 two_2011 three_2011 etc.... I'm trying to find all of these directories but coming up short. I tried find / -type d -name *2011 > example Any suggestions? I already searched in the... (13 Replies)
Discussion started by: shorty
13 Replies

9. UNIX for Advanced & Expert Users

Regular expression for finding OCR mistakes.

I have a large file of plain text, created using some OCR software. Some words have inevitably been got wrong. I've been trying to create grep or sed, etc., regular expressions to find them - but haven't quite managed to get it right. Here's what I'm trying to achieve: Output all lines which... (2 Replies)
Discussion started by: gencon
2 Replies

10. Shell Programming and Scripting

Grep with Regular expression now working on file directories

Hello Everyone, I have a file sam1 with the below content SYSYSID;MANDT;/SIE/AD_Z0M_INDX;/SIE/AD_Z0M_KEY1 echo $Regex \bSYSYSID\b|\bMANDT\b|\b/SIE/AD_Z0M_INDX\b|\b/SIE/AD_Z0M_KEY1\b cat sam1 | grep -Eo $Regex I expect the result as SYSYSID MANDT /SIE/AD_Z0M_INDX /SIE/AD_Z0M_KEY1... (4 Replies)
Discussion started by: sam99
4 Replies
LOCATE.CONF(5)						      BSD File Formats Manual						    LOCATE.CONF(5)

NAME
locate.conf -- locate database configuration file DESCRIPTION
The locate.conf file specifies the behavior of locate.updatedb(8), which creates the locate(1) database. The locate.conf file contains a list of newline separated records, each of which is composed of a keyword and arguments, which are separated by white space. Arguments with embedded shell metacharacters must be quoted in sh(1) style. Lines beginning with ``#'' are treated as com- ments and ignored. However, a ``#'' in the middle of a line does not start a comment. The configuration options are as follows: ignore pattern ... Ignore files or directories. When building the database, do not descend into files or directories which match one of the specified patterns. The matched files or directories are not stored to the database. Default: Not specified. ignorecontents pattern ... Ignore contents of directories. When building the database, do not descend into files or directories which match one of the speci- fied patterns. The matched files or directories themselves are stored to the database. Default: Not specified. ignorefs type ... Ignore file system by type, adding type to the default list. When building the database, do not descend into file systems which are of the specified type. The mount points are not stored to the database. If a ``!'' is prepended to type, the meaning is negated, that is, ignore file systems which do not have the type. As a special case, if ``none'' is specified for type, the ignorefs list is cleared and all file systems are traversed. type is used as an argument to find(1) -fstype. The sysctl(8) command can be used to find out the types of file systems that are available on the system: sysctl vfs.generic.fstypes Default: !local cd9660 fdesc kernfs procfs searchpath directory ... Specify base directories to be put in the database. Default: / workdir directory Specify the working directory of locate.updatedb, in which a temporary file is placed. The temporary file is a list of all files, and you should specify a directory that has enough space to hold it. Default: /tmp Refer to find(1) for the details of pattern (see -path expression) and type (see -fstype expression). FILES
/etc/locate.conf The file locate.conf resides in /etc. SEE ALSO
find(1), locate(1), locate.updatedb(8), sysctl(8) HISTORY
The locate.conf file format first appeared in NetBSD 2.0. AUTHORS
ITOH Yasufumi BSD
July 10, 2011 BSD
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy