LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: new location for LVS-HOWTOs

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: new location for LVS-HOWTOs
From: Roberto Nibali <ratz@xxxxxxxxxxxx>
Date: Tue, 02 Dec 2003 23:35:25 +0100
Hi,

Would this work to sort the error logs...

cat error_log.* | sort -o sorted-error_log -k 2M -k 3n

(use -r if you want the order reversed)

I don't understand why, but when I do this, it sorts on the fourth field as well (the time)...

It doesn't work with my sort or better with my LC_TIME settings. What's your output of locale?

If you want to sort with the '... -k xM ...' you need an appropriate LC_TIME entry or it will not work. A possible one is:

LC_TIME="%a %b %w %H:%M:%S %Y"

But this must be handwaved according to locale(5) and then compiled with localedef(3).

Lucky you if you have a charmap which matches the apache log files output ;).

Also read the info page on sort to see the difference between '-k 3n' and '-k 3,3n'. This is food for comp.unix.shell, btw! They know for sure.

`-k POS1[,POS2]'
`--key=POS1[,POS2]'
     Specify a sort field that consists of the part of the line between
     POS1 and POS2 (or the end of the line, if POS2 is omitted),
     _inclusive_.  Fields and character positions are numbered starting
     with 1.  So to sort on the second field, you'd use `--key=2,2'
     (`-k 2,2').  See below for more examples.

Best regards,
Roberto Nibali, ratz
--
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc

<Prev in Thread] Current Thread [Next in Thread>