Sponsored Content
Operating Systems OS X (Apple) how to find a string in file under multiple level dirs Post 302488155 by Scott on Saturday 15th of January 2011 01:20:27 PM
Old 01-15-2011
Isn't that the same question you asked in your previous thread (7 months ago)?

Find a word from multiple level files on Linux
These 3 Users Gave Thanks to Scott For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

using grep to find a value in current dir and sub dirs?

Hey guys, I would like to find all files which contain "client1.dat". I would like to search from the current directory and all subs and print out all the files that have this. Any help would be greatly appreciated. Thanks much. (10 Replies)
Discussion started by: ecupirate1998
10 Replies

2. Shell Programming and Scripting

script find files in two dirs HELP

I have a directory which is /home/mark/files/ , inside this particular I have a bunch of filles (see examples below) TST_SHU_00014460_20090302.txt TST_SHU_00016047_20090302.txt TST_SHU_00007838_20090303.txt TST_SHU_00056485_20090303.txt TST_SHU_00014460_20090303.txt... (2 Replies)
Discussion started by: fierusbentus
2 Replies

3. Shell Programming and Scripting

Find most recent files in dirs and tar them up?

Hey all.. This should be simple but stoopid here can't get head around it! I have many directories, say 100 each with many files inside. I need a script to traverse through the dirs, find most recent file in each dir and add it to a tar file. I can find the files with something like for... (1 Reply)
Discussion started by: bobdung
1 Replies

4. Shell Programming and Scripting

Find command and pruning .dirs

I'm sure this has been asked before but I couldn't find it with the search. I have a script that looks for files and then moves to another location for further processing. My problem is I can't seem to prune the .s* directories. It doesn't break anything just wanted a cleaner process. Here... (4 Replies)
Discussion started by: jcalisi
4 Replies

5. Red Hat

Find a word from multiple level files on Linux

To find a word from multiple level files: "find . -type f -exec grep {} +" is working on UNIX machines but not working on Linux machine. What is the equivalent command on Linux to find the word from multiple level files? Input is appreciated. (3 Replies)
Discussion started by: ywu081006
3 Replies

6. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

7. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

8. Emergency UNIX and Linux Support

find all the dirs starting with particular name

Hi Experts, I want to find all the dirs , subdirs on the sever which start with "sr". Can anyone let me know command for the same. find . -type d -name sr* I tried this but it is not working. Thanks, Ajay (4 Replies)
Discussion started by: ajaypatil_am
4 Replies

9. Shell Programming and Scripting

Script to find & replace a multiple lines string across multiple php files and subdirectories

Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ? The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories. So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Discussion started by: spfc_dmt
12 Replies

10. Shell Programming and Scripting

Replace a string in files in all dir and sub dirs

Hello, I need to replace xml version='1.1' with xml version='1.0' in all xml files under /app/jenkins/ in all dir and sub dirs in my CentOS VM, I tried below command but it didn't help, looks like I'm missing a character somewhere. grep -rl "xml version='1.1'" . | xargs sed -i 's/"xml... (2 Replies)
Discussion started by: mahesh Madpathi
2 Replies
XtFindFile()															      XtFindFile()

Name
  XtFindFile - search for a file using substitutions in a path.

Synopsis
  String XtFindFile(path, substitutions, num_substitutions, predicate)
	   String path;
	   Substitution substitutions;
	   Cardinal num_substitutions;
	   XtFilePredicate predicate;

Inputs
  path	    Specifies a path of file names including substitution characters.

  substitutions
	    Specifies a list of substitutions to make into the path.

  num_substitutions
	    Specifies the number of substitutions passed in.

  predicate Specifies a procedure called to judge each potential file name, or NULL.

Returns
  A filename, or NULL if no file was found.

Availability
  Release 4 and later.

Description
  XtFindFile()	performs the substitutions specified by substitutions on each colon-separated element of path in turn, and passes the result-
  ing string to predicate.  If predicate returns True, XtFindFile() returns the  string.   If  predicate  never  returns  True,  XtFindFile()
  returns NULL.

  Each	element  in substitutions is a structure that contains a character and a string.  If any element in path contains a percent sign fol-
  lowed by a character that appears in substitutions, then that two-character sequence will be replaced by the corresponding string  in  sub-
  stitutions.  The "Background" section below provides more details about the substitution process.

  If  predicate  is  NULL,  then  an  internal predicate is used that returns True if the string is the name of a readable file (and is not a
  directory), and returns False otherwise.  See XtFilePredicate(2) for more details on how to write a file predicate procedure.

  The caller must free the returned string with XtFree() when it is no longer needed.

Usage
  XtFindFile() is intended as a way to find a file that depends on variables such as the current setting of the locale, or the number of bit-
  planes  available on a screen.  Most applications can use the higher-level function XtResolvePathname() which provides a number of standard
  substitutions and a default path.

  The default predicate procedure is sufficient for most uses.	An application that wanted to find a directory rather than a file, for	exam-
  ple, would have to specify a custom predicate, as would an application that wanted to verify that a file was readable and that the contents
  of the file were reasonable would also have to provide a custom predicate procedure.

Background
  There are two substitution sequences that are treated specially:

  o  The character sequence %: (percent colon) specifies an embedded colon that is not a delimiter; the sequence  is  replaced	by  a  single
     colon.

  o  The  character  sequence  %%  (percent  percent)  specifies  a percent character that does not introduce a substitution; the sequence is
     replaced by a single percent character.

  A substitution string entry of NULL is equivalent to a pointer to an empty string.

  If the operating system does not interpret multiple embedded name separators in the path (i.e., "/" in POSIX) the same way as a single sep-
  arator,  XtFindFile() will collapse multiple separators into a single one after performing all string substitutions.	Except for collapsing
  embedded separators, the contents of the string substitutions are not interpreted by XtFindFile() and may therefore contain any  operating-
  system-dependent characters, including additional name separators.

Structures
  The Substitution type is defined as follows:

     typedef struct {
	 char match;
	 String substitution;
     } SubstitutionRec, *Substitution;

See Also
  XtResolvePathname(1),
  XtFilePredicate(2).

Xt - File Searching														      XtFindFile()
All times are GMT -4. The time now is 12:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy