On Fri, Jan 23, 2004 at 03:20:17AM -0200, Herculano de Lima Einloft Neto wrote: > > Hello all, > > This happens all the time: after an intricate find, I decide > to grep something out of that very same find, for instance. It > would be nice to have some tweak to reuse the last output without > having to run the command again. Anyone? It all depends on what you are tweaking. If the first "find" contains all the data you are looking for just save the output to a file. Since this "happens all the time" get in the habit and use a scratch file. Something like: In window one: find / -xdev -type f -name foo -o this -o that > /tmp/find.out wait; tput bel; sleep 1;tput bel; sleep 1;tput bel; sleep 1;tput bel In window two: tail -f /tmp/find.out | less There is an obvious caution, some searches can generate a gazillion bytes of output filling up the file system. You also have to know in advance that you are going to tweak your "find". This is the biggest reason that there is no 'standard' tool for this. For me the output of a command three back is really the one I want to tweak. So command history is the big win. N.B. "find" has options that are rich in file system meta data such as: -user -mtime -size -newer ... etc. If you tweak these you have to rerun the "find" because this info is not in the tmp file. Example touch /tmp/then logger nap-time sleep 20 logger nap-over touch /tmp/now find / -xdev -newer /tmp/then > /tmp/then.out find / -xdev -newer /tmp/now > /tmp/now.out Even though /tmp/then.out contains all the file names that you might want in /tmp/now.out the meta data is missing that would permit you to process the first file into the second. The good news is that the first meta data rich find can load the file system meta data into DRAM so the second might be quicker (if there is enough DRAM). If you do cache busting stuff all bets are off. Thus: find / -xdev -type f -print0 | xargs -0 grep magicword One tool I find very valuable is slocate/locate. It keeps a data base (cache) of file names that I find very handy. It is much quicker than a simple find looking for file names. I use "locate" a LOT. $ rpm -q --whatprovides `which locate` slocate-2.7-4 $ ls /etc/cron.daily/slocate.cron -- T o m M i t c h e l l mitch48-at-sbcglobal-dot-net