![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
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'
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
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'
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
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? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Registered User
Join Date: Apr 2003
Posts: 8
|
find . -name "index.html" -exec grep -qsv "myimage.gif" '{}' \; -print
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
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 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Join Date: Jul 2002
Location: Fort Lauderdale
Posts: 600
|
Quote:
__________________
AIM: PerlScriptor |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 | |
Registered User
Join Date: Apr 2003
Posts: 8
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
Confirmed User
Join Date: Jul 2002
Location: Fort Lauderdale
Posts: 600
|
Quote:
__________________
AIM: PerlScriptor |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |