daniels@well.UUCP (09/21/87)
Thanks to all who sent me suggestions concerning awk. It appears that the documentation is, uh, how shall we say... less than perfect. After 4 1/2 years of Unix, I should remember to take unix docs with a grain of rock salt :-) The solution to my problem seems to be that of having a shell script doing some pre-processing. A new question! I'm coming up with fast ways of determining all of the file name extensions in a directory. (this is in a csh script) The problem is, csh doesn't have a fast way of telling you that an element in a variable is just a basename (let's say $a was set from "set a=*", and you are looking for basename only files such as "Makefile", or "readme"). It would be good for csh to have a :b modifier... you could say "echo $a:gb" to get basename only files. The fastest way so far that I've come up with is: set bnames="" set tmp=$a while ($#tmp) if ($tmp[1]:r == $tmp[1]) then set bnames=($bnames $tmp[1]) endif shift tmp end I'm trying to avoid going into a loop, since most of the stuff I deal with might have directories with 20-200 files, and only 2 or 3 of those files are basename only. Sure this works, but I'm looking for more speed (I'll eventually rewrite a lot of this in C, but I'm quickly protyping some ideas in csh) Any ideas? dan smith dan smith, island graphics, marin co., ca | "I am responsible for everything uucp: ..!ucbvax!ucbcad!well!island!daniel | I've ever said since 1960!" uucp: ..!ptsfa!unicom!daniel !well!daniels | (415) 892 TANK (h) 491 1000 (w)