Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site wgivax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!mcnc!unccvax!wgivax!mo From: mo@wgivax.UUCP Newsgroups: net.unix Subject: Re: Re: command file HELP (flame on) Message-ID: <139@wgivax.UUCP> Date: Tue, 4-Feb-86 07:23:06 EST Article-I.D.: wgivax.139 Posted: Tue Feb 4 07:23:06 1986 Date-Received: Thu, 6-Feb-86 20:59:40 EST References: <137@wgivax.UUCP> Lines: 33 > from ram@wgivax >> If you only want the file names, this *might* work, I'm not sure ... >> find / -exec "fgrep this-is-the-string '{}' | awk -F: '{print $1}'" \; >> (DOUBLE UGGGHHH) >> -- > Or maybe... > find / -exec "fgrep this-is-the-string '{}' | awk '{print FILENAME}'" \; --------------------------- FLAME ON! --------------------------------------- WILL YOU PEOPLE PLEASE RTFM BEFORE MAKING SUGGESTIONS ABOUT HOW TO HELP WITH PROBLEMS? ADMITTEDLY THE FIRST WILL WORK, BUT WILL PRINT OUT THE FILE NAME FOR EVERY OCCURRENCE OF THE STRING IN A GIVEN FILE! THE SECOND "SUGGESTION" WILL PRINT OUT "-" FOR EVERY OCCURRENCE OF THE STRING IN EVERY FILE IT IS FOUND IN! (-: WHAT A HAPPY SUPRISE FOR THE PERSON WHO WAITS 12 HOURS FOR IT TO RUN, REDIRECTING IT INTO A FILE, TO FIND THAT ALL THE WORK WAS A WASTE :-) NOTE THAT BOTH SUGGESTIONS WOULD BE RUNNING NUMEROUS AWKS, ADDING AWK'S STARTUP COSTS FOR EACH AND EVERY FILE, DIRECTORY, DEVICE, ETC. IN THE SYSTEM (-: MAYBE 12 HOURS IS TOO LOW AN ESTIMATE, MAYBE 12 DAYS WOULD BE BETTER, UNLESS YOU'RE RUNNING A CRAY OR AN IBM-PC :-) --------------------------- FLAME OFF! -------------------------------------- OK, now that I have that out of my system, I will re-post a solution which I have fully TESTED (-: interesting idea, to test something before offering it as a solution, no? :-). find / -type f -exec fgrep -l "string" {} \; caveat emptor: (let the buyer beware, for those without high school latin) ALWAYS TRY SOMETHING LIKE THIS ON A SMALL SUBSET OF THE FILES WHICH ARE TO BE INCLUDED! LIKE: "find ~ ..."