On Thu, Nov 6, 2008 at 1:31 PM, Jay Hannah <span dir="ltr"><<a href="mailto:jay@jays.net">jay@jays.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br></div>
Does this help?<br>
<br>
$ find ./ -name "pat*" | xargs ls -at | head -1<div><div></div><div class="Wj3C7c"><br>
</div></div></blockquote></div><br>It's ironic that you put that, since that's pretty much the exact command I'm replacing. :) The problem is that one some of these systems "ls" is aliases to always put filesize in front (why? I don't know -- I find it annoying).<br>
<br>This is what I came up with after some googling and piecemailing. Anonymous subroutines are a good thing!<br><br>sub getLogFiles {<br><br><br> my ($logdir,$proc) = @_;<br><br> my @logfilelist =();<br><br> my %files={};<br>
<br> find(<br> sub {<br> if (/^$proc/s) {<br> my $filestats=stat($File::Find::name);<br> $files{$File::Find::name}=$filestats->mtime;<br> }<br><br> },$logdir);<br><br> my $myfile= (sort{ $files{$a}<=>$files{$b} } keys %files)[-1];<br>
<br> return $myfile;<br><br>}<br>-- <br>Mike Hostetler<br><a href="http://mike.hostetlerhome.com/">http://mike.hostetlerhome.com/</a><br><br><br>