RosettaCodeData/Task/Averages-Mode/Vedit-macro-language/averages-mode.vedit
2023-07-01 13:44:08 -04:00

25 lines
710 B
Text

BOF // Copy all data to a new buffer
Reg_Copy(10, ALL)
Buf_Switch(Buf_Free)
Reg_Ins(10)
Sort(0, File_Size) // Sort the data
BOF
repeat(ALL) { // Count & delete duplicate lines
#1 = 1
while(Match("^{.*}\N\1$", REGEXP)==0) {
Del_Line(1)
#1++
}
Num_Ins(#1, NOCR) // Insert item count at the beginning of line
Ins_Char(9) // TAB
Line(1, ERRBREAK) // Next (different) line
}
Sort(0, File_Size, REVERSE) // Sort according to the count
BOF // Display the results
Reg_Copy_Block(10, CP, EOL_pos)
Buf_Quit(OK)
Statline_Message(@10)