linux sort ignorning the leading zero
Page 1 of 1
Stainy




Posts: 280

PostPosted: Fri, 2nd Jul 2010 18:32    Post subject: linux sort ignorning the leading zero
I`m using this command in my script

tail -100 /tmp/upload.log | sort -rn >>log.log

The upload log entries start with dates ie. 01-07-10..

I want the log to start with the latest dates ( using -rn ) but it runs into trouble.

30-06-10 is fine... 31-06-10 is fine.. when 01-07-10 it sticks this at the bottom because of the leading zero..

I`ve searched the web and the man page on sort.. I can`t work it out Sad

anyone help ?
Back to top
PumpAction
[Schmadmin]



Posts: 26759

PostPosted: Fri, 2nd Jul 2010 18:43    Post subject:
Well first of all if you always use DD-MM-YY then write a script and change your log output to be in the format YY-MM-DD Smile


=> NFOrce GIF plugin <= - Ryzen 3800X, 16GB DDR4-3200, Sapphire 5700XT Pulse
Back to top
Stainy




Posts: 280

PostPosted: Sat, 3rd Jul 2010 14:23    Post subject:
Yeah I could do that.. but I would like the date format to stay the same..

so 01-07-10 will be above 31-06-10 etc..
Back to top
Page 1 of 1 All times are GMT + 1 Hour
NFOHump.com Forum Index - Programmers Corner
Signature/Avatar nuking: none (can be changed in your profile)  


Display posts from previous:   

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.8 © 2001, 2002 phpBB Group