The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
REGEX: Matching Null? deckard Shell Programming and Scripting 2 06-05-2008 10:56 AM
Stripping out extensions when file has multiple dots in name Nemelis Shell Programming and Scripting 8 05-14-2008 08:12 AM
Truncate multiple file extensions prvnrk Shell Programming and Scripting 12 04-04-2008 10:20 AM
regex to delete multiple blank lines in a file? fedora Shell Programming and Scripting 6 10-11-2007 04:36 PM
Find files with 3 different extensions mahalakshmi Shell Programming and Scripting 11 12-28-2006 06:19 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-08-2005
r0sc0 r0sc0 is offline
Registered User
  
 

Join Date: Dec 2005
Location: MD
Posts: 18
find -regex: matching multiple extensions

I want to use find to locate files with two different extensions, and run a grep on the results. The closest I have gotten is incredibly slow and ugly:
for i in `ls -laR|egrep -e '(.js|.css)'`; do find . -name $i -print|xargs grep -H searchBg; done;

This method makes my eyes bleed. Help!

Also, anyone know where I can read up on the -regex switch on find?

Thanks.
  #2 (permalink)  
Old 12-08-2005
pixelbeat pixelbeat is offline
Registered User
  
 

Join Date: Jun 2005
Location: Ireland
Posts: 61
export LANG=C #for speed
find -name "*.css" -o -name "*.js" -print0 |
xargs -r0 grep --color -FH searchBg

see also:
http://www.pixelbeat.org/scripts/findrepo
  #3 (permalink)  
Old 12-08-2005
r0sc0 r0sc0 is offline
Registered User
  
 

Join Date: Dec 2005
Location: MD
Posts: 18
find . -type f \( -name '*.css' -o -name '*.js' \) -print0|xargs -r0 grep --color -FH searchBg

worked a charm, thanks pixel
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0