S
S
Svoboo2016-10-11 13:51:36
Analytics
Svoboo, 2016-10-11 13:51:36

How to select the most frequently occurring lines in a file?

There is a file of about 10k lines, you need to select the top 50 lines that occur most often. What is the easiest way to implement this and how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xSkyFoXx, 2016-10-11
@xSkyFoXx

  • Открываете любой скриптовый язык, который знаете.
  • Делаете элементарный препроцессинг: всё приводите к нижнему регистру, убираете знаки препинания и т.п.
  • Разбиваете всё на пары ключ: значение ("слово": 1, "другое": 1).
  • Группируете по ключу. Функция группировки значений - сумма.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question