Script to analyze text streams to split and count by week number
51 USDI have lots of files which have the date YYYY-MM-DD in the first field.
I want to be able to easily split, count, or label the lines.
Any content after the first tab is considered one block. Content after the first tab could contain any text, utf8, including tabs.
----
Example input:
2016-11-04a
2016-11-04b
2016-11-07c
2016-11-08d
----
Example output with "-w" for "week number":
45 2016-11-04a
45 2016-11-04b
46 2016-11-07c
46 2016-11-08d
Inserted field 1 is the week number 1..52, restarts at zero each year. This inserts week numbers in new field 1.
Variant -w0 is the same, but count first week from 0 instead of 1,
----
Example output with "-b" for "line Break":
2016-11-04a
2016-11-04b
2016-11-07c
2016-11-08d
Note the extra line break between weeks. Just one line break between weeks.
----
Example output with "-w" for "week start day and count".
# WEEK of 2016-10-30: 2
2016-11-04a
2016-11-04b
# WEEK of 2016-11-06: 2
2016-11-07c
2016-11-08d
The week start date is inserted once at the start of any week, after the colon is the count.
----
Option -z to output each week (between first and last), even if count = 0.
The purpose is if there's sparse data, eg many empty weeks.
----
Option to set the week start. Default week start = Sunday. -s = sunday, -m = monday
----
Option -y to invert the date to DD-MM-YYYY instead of YYYY-MM-DD.
----
Options can be combined. -help, -h = list of options.
No options = -w -b -s
----
I will invoke your script with piped input on the command line. Ubuntu or MacOSX. (Use normal ruby, perl, etc.) Script should be self-contained. I will provide test files.
-
260 Expirienced perl developer, ready to take it.
-
5 days51 USD
28 1 0 5 days51 USDI can do this in Ruby
Current freelance projects in the category Ruby
Generation of XML Price for Subordinate according to TZThe Ruby on Rails. You need to generate a XML price for the subcontractor according to its tz. Access to the code on GitHub, we’ll test together. Ruby |