![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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. |
|
||||
|
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 |
|
||||
|
find . -type f \( -name '*.css' -o -name '*.js' \) -print0|xargs -r0 grep --color -FH searchBg
worked a charm, thanks pixel ![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|