How to sort by date in descending order
Roberto Ragusa
mail at robertoragusa.it
Sat Feb 27 17:20:13 UTC 2010
Dave Cross wrote:
> On 26 February 2010 13:40, Roberto Ragusa <mail at robertoragusa.it> wrote:
>> Richard Cahilig wrote:
>>> Your help is very much appreciated. Thanks.
>> while read a b; do s1=`date --date "$b" +%s`; echo $s1 $a $b;done <yourfile.txt | sort -nr
>
> Very nice. Just one small addition - pass the output through cut to
> get back to the original data format:
>
> while read a b; do s1=`date --date "$b" +%s`; echo $s1 $a $b;done
> <yourfile.txt | sort -nr | cut -f 2- -d ' '
I left that as an exercise for the reader ;-)
--
Roberto Ragusa mail at robertoragusa.it
More information about the users
mailing list