Sponsored Content
Top Forums Shell Programming and Scripting Shell:Find a word in files in a directory and subdirectories Post 302230318 by yeclota on Friday 29th of August 2008 04:18:27 AM
Old 08-29-2008
find . -exec grep -l 'toto' {} \

find . -exec grep -l 'toto'{}\;

return
find: 0652-018 An expression term lacks a required parameter.

can you give me some details because i'm not an expert in shell programming.

Thanks.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find all files created by a specified user in a directory and its subdirectories

Is there a command or shell script which can be used for Finding all files created by a specified userid in a directory and its subdirectories. Say, I want to find all such files in directory /abc as well as in all the subdirectories such as /abc/xyz or /abc/xyz/pqr aqnd so on which was created... (5 Replies)
Discussion started by: abhilashnair
5 Replies

2. UNIX for Dummies Questions & Answers

How to find a word in a all the files in a Directory??

I want to find a specific word present in all the files ina directory....Please tell me the command to be used?? Thanks (6 Replies)
Discussion started by: shikhakaul
6 Replies

3. UNIX for Dummies Questions & Answers

Find Files in a Directory Excluding Subdirectories

Hi, I have a filename Location.txt in a directory /abc. Similar name file is present in its subdirectory /abc/xyz. I want to find the file which is present only in /abc and not in /abc/xyz. Please any1 of u can provide a quick suggestion. Its very urgent. Thanks, Amol (2 Replies)
Discussion started by: Amol_Dicholkar
2 Replies

4. Shell Programming and Scripting

to parse a directory and its subdirectories and find owner name of files

hi all, i need to capture all the files in a directory and its subdirectories that have owner name different than the root owner. for one file it is " stat -c %U filename " but i need to search for each and every file and record it. thanks in advance (14 Replies)
Discussion started by: vyasa
14 Replies

5. Shell Programming and Scripting

Find directory name while traversing subdirectories

Hi, I have a parent directory in which I have sub directories of different depth /usr/usr1/user2/671 /usr/usr1/672 /usr/user2/user1/673 /usr/user2/user3/user4/674 And I need the names of all the directories that which starts only with 6 in a file. Thanks, (12 Replies)
Discussion started by: arun_maffy
12 Replies

6. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

7. Shell Programming and Scripting

Find files only in current directory...not subdirectories

Hi, I have to find files only in the current directory...not in the sub directories. But when I use Find command ... it searches all the files in the current directory as well as in the subdirectories. I am using AIX-UNIX machine.Please help..I tried to use maxdepth..but it is not working in AIX. (2 Replies)
Discussion started by: vsachan
2 Replies

8. Shell Programming and Scripting

Find command to search files in a directory excluding subdirectories

Hi Forum, I am using the below command to find files older than x days in a directory excluding subdirectories. From the previous forums I got to know that prune command helps us not to descend in subdirectories. Though I am using it here, not getting the desired result. cd $dir... (8 Replies)
Discussion started by: jhilmil
8 Replies

9. Shell Programming and Scripting

Find word in a directory files

Hi folks, i have a file in which i have words like below words.txt(file name) and words are arranged likes no spaces between words Apple Banana Carrot And i have list files which have these words in a directory (/tmp/satemp) test1.txt test2.txt test3.txt So if the word 'Apple' is... (3 Replies)
Discussion started by: coolboy98699
3 Replies

10. Shell Programming and Scripting

Find/searching files in subdirectories excluding the fiels in Parent Directory

Hi All, requirement is to find and remove the files from sub directories but it should exclude the files from parent directory. At present i am using the below one but it finds and remove files from both parent and sub directories. find ${PATH} -type f \( -name securitas\* -o -name \*gz... (1 Reply)
Discussion started by: Naveenkk
1 Replies
rheostream(2rheolef)						    rheolef-6.1 					      rheostream(2rheolef)

NAME
irheostream, orheostream - large data streams ABSTRACT
This class provides a stream interface for large data management. File decompresion is assumed using gzip and a recursive seach in a directory list is provided for input. orheostream foo("NAME", "suffix"); is like ofstream foo("NAME.suffix"). However, if NAME does not end with `.suffix', then `.suffix' is added, and compression is done with gzip, adding an additional `.gz' suffix. Conversely, irheostream foo("NAME","suffix"); is like ifstream foo("NAME.suffix"). However, we look at a search path environment variable RHEOPATH in order to find NAME while suffix is assumed. Moreover, gzip compressed files, ending with the `.gz' suffix is assumed, and decompression is done. Finally, a set of useful functions are provided. DESCRIPTION
The following code: irheostream is("results", "data"); will recursively look for a `results[.data[.gz]]' file in the directory mentionned by the RHEOPATH environment variable. For instance, if you insert in our ".cshrc" something like: setenv RHEOPATH ".:/home/dupont:/usr/local/math/demo" the process will study the current directory `.', then, if neither `square.data.gz' nor `square.data' exits, it scan all subdirectory of the current directory. Then, if file is not founded, it start recusively in `/home/dupond' and then in `/usr/local/math/demo'. File decompression is performed by using the gzip command, and data are pipe-lined directly in memory. If the file start with `.' as `./square' or with a `/' as `/home/oscar/square', no search occurs and RHEOPATH environment variable is not used. Also, if the environment variable RHEOPATH is not set, the default value is the current directory `.'. For output stream: orheostream os("newresults", "data"); file compression is assumed, and "newresults.data.gz" will be created. File loading and storing are mentionned by a message, either: ! load "./results.data.gz" or: ! file "./newresults.data.gz" created. on the clog stream. By adding the following: clog << noverbose; you turn off these messages (see iorheo(4)). IMPLEMENTATION
class irheostream : public io::filtering_stream<io::input> { public: irheostream() : io::filtering_stream<io::input>() {} irheostream(const std::string& name, const std::string& suffix = std::string()); virtual ~irheostream(); void open (const std::string& name, const std::string& suffix = std::string()); void close(); protected: std::ifstream _ifs; }; class orheostream : public io::filtering_stream<io::output> { public: orheostream() : io::filtering_stream<io::output>() {} orheostream(const std::string& name, const std::string& suffix = std::string()); virtual ~orheostream(); void open (const std::string& name, const std::string& suffix = std::string()); void close(); protected: std::ofstream _ofs; }; std::string itos (std::string::size_type i); std::string ftos (const Float& x); // catch first occurence of string in file bool scatch (std::istream& in, const std::string& ch); // has_suffix("toto.suffix", "suffix") -> true bool has_suffix (const std::string& name, const std::string& suffix); // "toto.suffix" --> "toto" std::string delete_suffix (const std::string& name, const std::string& suffix); // "/usr/local/dir/toto.suffix" --> "toto.suffix" std::string get_basename (const std::string& name); // "/usr/local/dir/toto.suffix" --> "/usr/local/dir" std::string get_dirname (const std::string& name); // "toto" --> "/usr/local/math/data/toto.suffix" std::string get_full_name_from_rheo_path (const std::string& rootname, const std::string& suffix); // "." + "../geodir" --> ".:../geodir" void append_dir_to_rheo_path (const std::string& dir); // "../geodir" + "." --> "../geodir:." void prepend_dir_to_rheo_path (const std::string& dir); bool file_exists (const std::string& filename); // string to float bool is_float (const std::string&); Float to_float (const std::string&); // in TMPDIR environment variable or "/tmp" by default std::string get_tmpdir(); SEE ALSO
iorheo(4) rheolef-6.1 rheolef-6.1 rheostream(2rheolef)
All times are GMT -4. The time now is 06:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy