[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: general linux questions



On Thu, Oct 05, 2000 at 04:40:52PM +0100, Colin Watson wrote:
> Ethan Benson <erbenson@alaska.net> wrote:
> >On Thu, Oct 05, 2000 at 04:22:06PM +0200, robert_wilhelm_land wrote:
> >> When searching for filenames using "locate" and displaying them in
> >> the order of their date something like "locate <file> | <sort_them>",
> >> (does the database include other parameters than just filenames?)
> >
> >not sure on this one.
> 
> You could try something like:
> 
>   locate <file> | xargs ls -dl
> 
> ... and then work out how to sort the resulting list by date.

i keep forgetting about xargs. very clever gizmo!

to sort the output by date, it's rather simple:

	locate <path-match-string> | xargs ls -dlt

the -d is so directoriy contents wouldn't be listed, only the directory
item itself; -l says 'gimme a long listing' and -t says 'sort by modified
time'...

% man ls
<snip>
       --sort=WORD
              extension -X, none -U, size -S, time -t, version -v
              status -c, time -t, atime -u, access -u, use -u

       --time=WORD
              show time as WORD  instead  of  modification  time:
              atime,  access, use, ctime or status; use specified
              time as sort key if --sort=time

hell, sort it however you like. :)

-- 
things are more like they used to be than they are now.

will@serensoft.com *** http://www.dontUthink.com/



Reply to: