Sponsored Content
Top Forums UNIX for Dummies Questions & Answers What is the Best way to search files for a string?? Post 302178103 by Franklin52 on Monday 24th of March 2008 04:08:16 PM
Old 03-24-2008
Try something like:

Code:
grep -i <pattern> `find`

Regards
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search all files for specific string

Hi Friends, How can I search all files in all slices on a unix system for a particular string within the file. e.g search string 'oracle' Thanks (4 Replies)
Discussion started by: sureshy
4 Replies

2. UNIX for Dummies Questions & Answers

Search files for a string in the remote machine

Hi all, I want to search the files in a remote machine for a particular string. The SSH command I wrote is giving an error even when the syntax is correct. ssh user@hostmachine find . -name "*.txt" -exec grep "ARIVU" '{}' \; The error it gives is find: missing argument to `-exec' When the... (2 Replies)
Discussion started by: a_rivu
2 Replies

3. UNIX for Dummies Questions & Answers

String Search within Text Files

I have many scripts in directories and sub-directories that I would like to search for a specific string. How would I do that? (1 Reply)
Discussion started by: bggibson
1 Replies

4. UNIX for Dummies Questions & Answers

Search for Files that DONT contain a string

How do I search for files that dont contain a certain string? I am currently trying find ./logs -size +1c -exec grep -l 'Process Complete' {} \; -exec ls -l {} \; > $TOD Which gives me files that are reater han 0 file size and contain the string 'Process complete' but I want files that DONT... (13 Replies)
Discussion started by: tonydsam
13 Replies

5. Shell Programming and Scripting

Search and replace string in files

I'm trying to remove the following string from several files. <img heigth="1" width="1" border="0" src="http://myteenmovies.net/t.php?id=5540372">I'm using the following script #!/bin/bash # This script will search and replace all regular files for a string # supplied by the user and... (1 Reply)
Discussion started by: d13g0sv
1 Replies

6. Shell Programming and Scripting

Help with search string between two files

Hi, Basically i want to search for a string in file two based on the input file one and if it matches get the nextline and print the value of the field name. cat one abc xyz defcat two <src> <name="path/to/abc" test="value_version"> <new name="Y2" > </src> <src> <name="path/to/xyz"... (5 Replies)
Discussion started by: greet_sed
5 Replies

7. Shell Programming and Scripting

Search several string and convert into a single line for each search string using awk command AIX?.

I need to search the file using strings "Request Type" , " Request Method" , "Response Type" and by using result set find the xml tags and convert into a single line?. below are the scenarios. Cat test Nov 10, 2012 5:17:53 AM INFO: Request Type Line 1.... (5 Replies)
Discussion started by: laknar
5 Replies

8. Shell Programming and Scripting

Search string within a file and list common words from the line having the search string

Hi, Need your help for this scripting issue I have. I am not really good at this, so seeking your help. I have a file looking similar to this: Hello, i am human and name=ABCD. How are you? Hello, i am human and name=PQRS. I am good. Hello, i am human and name=ABCD. Good bye. Hello, i... (12 Replies)
Discussion started by: royzlife
12 Replies

9. Shell Programming and Scripting

Read files incrementally and search for particular string.

Example I have following requirements where i need to search for particular string from the log files.Files will be archived with number attached end to it and creates a new log file. First Day i will ran at 8:00 AM Filename:a.log1 Wed Aug 24 04:46:34... (1 Reply)
Discussion started by: nareshnani211
1 Replies

10. UNIX for Beginners Questions & Answers

Loop through the folders and search for particular string in files

Hello, Opearting System Environment : HP Unix B.11.31 U I look for script to On specific folders list On specific filelist Search for given string For Example : r48_buildlib.txt contains wpr480.0_20161027 wpr480.0_20161114 wpr481.0_20161208 wpr482.0_20161222... (4 Replies)
Discussion started by: Siva SQL
4 Replies
MrmOpenHierarchy(3X)													      MrmOpenHierarchy(3X)

NAME
MrmOpenHierarchy - Allocates a hierarchy ID and opens all the UID files in the hierarchy SYNOPSIS
#include <Mrm/MrmPublic.h> Cardinal MrmOpenHierarchy(num_files, file_names_list, ancillary_structures_list, hierarchy_id) MrmCount num_files; String file_names_list[]; MrmOsOpenParamPtr *ancillary_structures_list; MrmHierarchy *hierarchy_id; DESCRIPTION
This routine is obsolete and exists for compatibility with previous releases. It is replaced by MrmOpenHierarchyPerDisplay. MrmOpenHierar- chy is identical to MrmOpenHierarchyPerDisplay except that MrmOpenHierarchy does not take a display argument. Specifies the number of files in the name list. Specifies an array of character strings that identify the UID files. A list of operating-system-dependent ancil- lary structures corresponding to such things as filenames, clobber flag, and so forth. This argument should be NULL for most operations. If you need to reference this structure, see the definition of MrmOsOpenParamPtr in <MrmPublic.h> for more information. Returns the search hierarchy ID. The search hierarchy ID identifies the list of UID files that MRM searches (in order) when performing subsequent fetch calls. Each UID file string in file_names_list can specify either a full pathname or a filename. If a UID file string has a leading slash (/), it specifies a full pathname, and MRM opens the file as specified. Otherwise, the UID file string specifies a filename. In this case MRM looks for the file along a search path specified by the UIDPATH environment variable or by a default search path, which varies depending on whether or not the XAPPLRESDIR environment variable is set. The UIDPATH environment variable specifies a search path and naming conventions associated with UID files. It can contain the substitution field %U, where the UID file string from the file_names_list argument to MrmOpenHierarchyPerDisplay is substituted for %U. It can also con- tain the substitution fields accepted by XtResolvePathname. The substitution field %T is always mapped to uid. The entire path is first searched with %S mapped to .uid and then, if no file is found, is searched again with %S mapped to NULL. If no display is set prior to calling this function, the result of this function's call to XtResolvePathname is undefined. For example, the following UIDPATH value and MrmOpenHierarchy call cause MRM to open two separate UID files: UIDPATH=/uidlib/%L/%U.uid:/uidlib/%U/%L static char *uid_files[] = {"/usr/users/me/test.uid", "test2"}; MrmHierarchy *Hierarchy_id; MrmOpenHierarchy((MrmCount)2,uid_files, NULL, Hierarchy_id) MRM opens the first file, /usr/users/me/test.uid, as specified in the file_names_list argument to MrmOpenHierarchy, because the UID file string in the file_names_list argument specifies a full pathname. MRM looks for the second file, test2, first as /uidlib/%L/test2.uid and second as /uidlib/test2/%L, where the display's language string is substituted for %L. After MrmOpenHierarchy opens the UID hierarchy, you should not delete or modify the UID files until you close the UID hierarchy by calling MrmCloseHierarchy. If UIDPATH is not set but the environment variable XAPPLRESDIR is set, MRM searches the following pathnames: %U%S $XAPPLRESDIR/%L/uid/%N/%U%S $XAPPLRESDIR/%l/uid/%N/%U%S $XAPPLRESDIR/uid/%N/%U%S $XAPPLRESDIR/%L/uid/%U%S $XAPPLRESDIR/%l/uid/%U%S $XAPPLRESDIR/uid/%U%S $HOME/uid/%U%S $HOME/%U%S /usr/lib/X11/%L/uid/%N/%U%S /usr/lib/X11/%l/uid/%N/%U%S /usr/lib/X11/uid/%N/%U%S /usr/lib/X11/%L/uid/%U%S /usr/lib/X11/%l/uid/%U%S /usr/lib/X11/uid/%U%S /usr/include/X11/uid/%U%S If neither UIDPATH nor XAPPLRESDIR is set, MRM searches the following pathnames: %U%S $HOME/%L/uid/%N/%U%S $HOME/%l/uid/%N/%U%S $HOME/uid/%N/%U%S $HOME/%L/uid/%U%S $HOME/%l/uid/%U%S $HOME/uid/%U%S $HOME/%U%S /usr/lib/X11/%L/uid/%N/%U%S /usr/lib/X11/%l/uid/%N/%U%S /usr/lib/X11/uid/%N/%U%S /usr/lib/X11/%L/uid/%U%S /usr/lib/X11/%l/uid/%U%S /usr/lib/X11/uid/%U%S /usr/include/X11/uid/%U%S These paths are defaults that vendors may change. For example, a vendor may use different directories for /usr/lib/X11 and /usr/include/X11. The following substitutions are used in these paths: The UID file string, from the file_names_list argument. The class name of the appli- cation. The display's language string. The language component of the display's language string. The suffix to the file name. The entire path is searched first with a suffix of .uil, and if no file is found, it is searched again with a NULL suffix. RETURN VALUES
This function returns one of these status return constants: The function executed successfully. File not found. The function failed. SEE ALSO
MrmOpenHierarchyPerDisplay(3X), MrmCloseHierarchy(3X) MrmOpenHierarchy(3X)
All times are GMT -4. The time now is 04:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy