Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-30-2004, 01:56 AM   #1
Zester
Confirmed User
 
Zester's Avatar
 
Industry Role:
Join Date: Jul 2003
Posts: 5,344
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?
__________________
* Mainstream ? $65 per sale
* new male contraception
Zester is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:06 AM   #2
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
find . -type f -name "index.html" | xargs cat|grep -l -v 'myimage.gif'
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:10 AM   #3
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
find ./ -type f -name index*.html|xargs grep -l -v 'myimage.gif'
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:11 AM   #4
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
The last one worked just fine for me.
What is your error if any?
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:11 AM   #5
rivalen
Registered User
 
Join Date: Apr 2003
Posts: 8
find . -name "index.html" -exec grep -qsv "myimage.gif" '{}' \; -print
rivalen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:12 AM   #6
NiteRain
Confirmed User
 
Join Date: Jul 2002
Location: Fort Lauderdale
Posts: 600
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
__________________
AIM: PerlScriptor
NiteRain is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:15 AM   #7
NiteRain
Confirmed User
 
Join Date: Jul 2002
Location: Fort Lauderdale
Posts: 600
Quote:
Originally posted by V_RocKs
find ./ -type f -name index*.html|xargs grep -l -v 'myimage.gif'
Yup that works great V_Rocks
__________________
AIM: PerlScriptor
NiteRain is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:16 AM   #8
rivalen
Registered User
 
Join Date: Apr 2003
Posts: 8
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
rivalen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:17 AM   #9
NiteRain
Confirmed User
 
Join Date: Jul 2002
Location: Fort Lauderdale
Posts: 600
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.
__________________
AIM: PerlScriptor
NiteRain is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-30-2004, 02:53 AM   #10
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
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...
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.