string search in folders with particular multiple file extension


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers string search in folders with particular multiple file extension
# 1  
Old 10-24-2005
string search in folders with particular multiple file extension

Hi,

I am newbie in UNIX so please excuse for my questions.

Is there a a way to search for string in files within folder and sub folder in particluar file extensions.

Ex. search for ABC in folder 'A'(including it's sub folders) in html, xml files.

Thanks,
Ani
# 2  
Old 10-24-2005
find /folder/path -name "*.html" -or -name "*.xml" | xargs grep ABC

or, if you run into errors due to space characters in the filename:

find /folder/path -name "*.html" -or -name "*.xml" -print0 | xargs -0 grep ABC

man find for more info
# 3  
Old 10-28-2005
Thanks vertigo23.

Thanks vertigo23
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. 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

3. Shell Programming and Scripting

Search for specific file type in subdirectory with multiple folders

I have a directory that is in the below order (the --- is not part of the directory tree, only there to help illustrate: DATE --- main level Folder1 --- level under DATE plugin_out --- level under Folder1 variantCaller_out.40 --- level under plugin_out 001,002,003 --- level under... (3 Replies)
Discussion started by: cmccabe
3 Replies

4. Shell Programming and Scripting

Command to Search a FILE for a STRING in multiple DIRECTORIES

Hi, Can someone please help me with a Command to Search a FILE for a STRING in multiple DIRECTORIES. I am searching for the VIP in HTTPD.CONF in multiple httpd instances. I am using find ./ -name "httpd.conf" | xargs grep 10.22.0.141 cut -d: -f3- | cut -d ' ' -f4 | sort | uniq -c ... (1 Reply)
Discussion started by: crosairs
1 Replies

5. Shell Programming and Scripting

To search multiple string in file

hi , i am having a file where i need to take ignore the data from file1.txt and redirect to another file for eg: file1.txt AUS USA file2.txt AUS,123 NZ,11 USA,12 i am using the below code (4 Replies)
Discussion started by: rohit_shinez
4 Replies

6. 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

7. Shell Programming and Scripting

search for a file extension

hi all, i'm new to shell scripting, i need help from u guys to do my task now.. i just need to check a file extension existence in a directory, and if it exists then i have to continue my processing. pls give me the command to check the extension of the files (6 Replies)
Discussion started by: divak
6 Replies

8. Shell Programming and Scripting

Search multiple strings on a file and copy the string next to it

I tried awk for this, but failed <or my code is not correct? I dont know>. Can anyone help me on this? ---------- Post updated at 08:34 PM ---------- Previous update was at 08:29 PM ---------- my working file looks like this: <empty> <empty> <empty> NAME :ABC AGE :15 GENDER... (6 Replies)
Discussion started by: kingpeejay
6 Replies

9. Shell Programming and Scripting

Multiple search string in multiple files using awk

Hi, filenames: contains name of list of files to search in. placelist contains the names of places to be searched in all files in "filenames" for i in $(<filenames) do egrep -f placelist $i if ] then echo $i fi done >> outputfile Output i am getting: (0 Replies)
Discussion started by: pinnacle
0 Replies

10. UNIX for Dummies Questions & Answers

problem with grep on search string in a txt file over multiple files

I have a couple of things I got stuck on 1) I have a text file containing 25k search string that I need to search against compressed file. I have used this command but somehow it doesn't seems to use all the search terms. I have put one search string per line in the txt file (I clean up... (2 Replies)
Discussion started by: m00
2 Replies
Login or Register to Ask a Question