Разместите свой проект бесплатно и начните получать предложения от фрилансеров-исполнителей уже спустя минуты после публикации!
2000 ₴

Script to analyze text streams to split and count by week number

истекло время актуальности


I 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. 




Сделать ставку!

Заказчик не желает делать предоплату? Предложите оплату через Сейф, чтобы избежать возможного мошенничества.

  1. 5 дней2000 ₴
    Евгений Пивоваров
     105   1   0

    I can do this in Ruby

    Украина Киев | 22 ноября 2016 |
  2. 3 дня2000 ₴
    Андрей Кашель
     240 

    Expirienced perl developer, ready to take it.

    Украина Киев | 27 ноября 2016 |

Заказчик
Sergei Lemberg
США Washington
Проект опубликован
22 ноября 2016
37 просмотров
Способы оплаты
Метки
Поделиться