It would still be quicker with shell tools, imho, granted that some command line elitistry would be required... Also if you are going to be doing string parsing and manipulation, and string parsing here is all that you are doing, there would be no better language than perl to do it with, granted i dont like perl and prefer python or php or ruby to it, but when you have a lot of string manipulation, perl has no rival i have used yet, though i guess if awk were combined with sed, there would be some potential... -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray On Fri, Jul 22, 2011 at 9:33 AM, Nilesh Govindarajan <contact@xxxxxxxxxxxx>wrote: > On 07/22/2011 06:56 PM, Alex Nikitin wrote: > > > > > > Or you could just grep the directory, not saying you have to do this, > > but this was kind of fun to write anyways, if i spent more time on it, i > > could perfect it, but i dont have that kind of time, so this will still > > give you a few doubles, but it shouldn't give you false-positives as > > long as you have all the extensions in that grep regex (and you cant > > make it more generic without introducing false-positives)... > > > > grep -oiPR "[a-zA-Z0-9]+\.(php|js|png| > > jpg|css|htm|html)" directory | awk 'function getfiles(input, files, i, > > n, file) {result = ""; n=split(input, files, ":"); for(i=0; i<=n; i++) { > > if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu > > > > This should give you all the files that reference files and the files > > they reference. > > > > -- > > The trouble with programmers is that you can never tell what a > > programmer is doing until it’s too late. ~Seymour Cray > > > > It is possible to use the shell tools, but it is a big trouble to handle > spaces and special characters in shell scripting if your filenames have > them, quite rare with self created applications, but you can't say, and > hence I suggested python/php script method. > > -- > Regards, > Nilesh Govindarajan > @nileshgr on twitter/identica >