Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Need a one liner or maybe more...
This must be a simple one...

I need to find the count of lines falling into specific dates in a .dat
file dynamically.  (ie) for each unique date (Y/M/D excluding time) it
should give out totals.

This is how the file will look:

0|3|2005/05/01 23:10:49||733422094
0|3|2005/05/01 23:47:23||733823935
0|3|2005/05/02 04:03:45||734677852
0|5|2005/05/02 00:01:27||715880879
0|3|2005/05/01 23:41:01||734394379
0|3|2005/05/01 23:46:27||733823935
0|2|2005/05/02 05:12:24||733091614
0|3|2005/05/01 23:47:56||733823935

In this case I need the output to display
2005/05/01 5
2005/05/02 3

| - is the field seperator.

Let me know if anybody has any scripts handy.

Thx Rex


Report this thread to moderator Post Follow-up to this message
Old Post
Benz
05-06-05 01:55 PM


Re: Need a one liner or maybe more...

Benz wrote:
> This must be a simple one...
>
> I need to find the count of lines falling into specific dates in a .dat
> file dynamically.  (ie) for each unique date (Y/M/D excluding time) it
> should give out totals.
>
> This is how the file will look:
>
> 0|3|2005/05/01 23:10:49||733422094
> 0|3|2005/05/01 23:47:23||733823935
> 0|3|2005/05/02 04:03:45||734677852
> 0|5|2005/05/02 00:01:27||715880879
> 0|3|2005/05/01 23:41:01||734394379
> 0|3|2005/05/01 23:46:27||733823935
> 0|2|2005/05/02 05:12:24||733091614
> 0|3|2005/05/01 23:47:56||733823935
>
> In this case I need the output to display
> 2005/05/01 5
> 2005/05/02 3
>
> | - is the field seperator.
>
> Let me know if anybody has any scripts handy.
>
> Thx Rex
>
gawk -F"[| ]" '{c[$3]++}END{for (d in c) print d, c[d]}'

Ed.

Report this thread to moderator Post Follow-up to this message
Old Post
Ed Morton
05-06-05 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

AWK archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:32 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.