GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Programers and unix admins: (https://gfy.com/showthread.php?t=395921)

Zester 11-30-2004 01:56 AM

Programers and unix admins:
 
ok.

here is a bash command line question:

let's say I'm currently in a directory call "members".
in the "members" directory there are sub-directories: "john", "Tami", "Bob".
inside each of those sub directories there are a few .html files, one of them is "index.html".

what I want is to scan the content of those "index.html" files in every sub-directory ("john", "Tami", "Bob")
and print out the "index.html" files that DO NOT contain the word "myimage.gif".

how do I do that? this is what I tried and failed:

find . -type f -name "index.html" | xargs grep -l -v 'myimage.gif'
find . -type f -name "index.html" | xargs grep -l -v "myimage.gif"
find . -type f -name "index.html" | xargs grep -l -v 'myimage\.gif'


anyone know a good unix forum I can ask this question?

V_RocKs 11-30-2004 02:06 AM

find . -type f -name "index.html" | xargs cat|grep -l -v 'myimage.gif'

V_RocKs 11-30-2004 02:10 AM

find ./ -type f -name index*.html|xargs grep -l -v 'myimage.gif'

V_RocKs 11-30-2004 02:11 AM

The last one worked just fine for me.
What is your error if any?

rivalen 11-30-2004 02:11 AM

find . -name "index.html" -exec grep -qsv "myimage.gif" '{}' \; -print

NiteRain 11-30-2004 02:12 AM

You are looking for something like this in BASH:

for i in `find . -type f -name "index.html"`; do if ( grep -v "myimage\.gif" $i >/dev/null ); then echo $i; fi ; done

NiteRain 11-30-2004 02:15 AM

Quote:

Originally posted by V_RocKs
find ./ -type f -name index*.html|xargs grep -l -v 'myimage.gif'
Yup that works great V_Rocks

rivalen 11-30-2004 02:16 AM

Quote:

Originally posted by rivalen
find . -name "index.html" -exec grep -qsv "myimage.gif" '{}' \; -print
hmmm...my command got ganked...haha123; should be the opening bracket

NiteRain 11-30-2004 02:17 AM

Quote:

Originally posted by V_RocKs
find . -type f -name "index.html" | xargs cat|grep -l -v 'myimage.gif'
Get this Standard Input message on this one.

V_RocKs 11-30-2004 02:53 AM

Quote:

Originally posted by NiteRain
Get this Standard Input message on this one.
Yeah... I didn't read the part about it outputing the files name...


All times are GMT -7. The time now is 07:44 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123