User: Verotiana -- 2016-05-23 << 1365 1367 >> |
Hits: 2976 |
Type: Count and statistics |
Search all Count and statistics examples |
Description: |
Count the number of times a line with the same first column (sequence number) and same last two columns is repeated. Output the first column, the last two columns and the number of times it appears. If possible at the end, count the number of times the same last two column pattern has appeared with distinct sequence numbers, and the average times it has appeared with each sequence number. This can be split in two steps if it can't work with one step. Thank you. |
Input Sample: |
1430 F C 1430 F C B 1430 F C B R 1357 G F 1357 G F 1357 G F 1357 G F 1357 G F C 1357 G F C B 1357 G F C B R 1431 F C 1431 F C B 1358 G F 1432 F C 1432 F C B 1432 F C B R 1359 G F 1359 G F |
Output Sample: |
1430 F C 1 1430 C B 1 1430 B R 1 1357 G F 4 1357 F C 1 1357 C B 1 1357 B R 1 1431 F C 1 1431 C B 1 1358 G F 1 1432 F C 1 1432 C B 1 1432 B R 1 1359 G F 2 Total/Average F C 4/1 C B 4/1 B R 3/1 G F 3/2.333 |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open text file 2. ctrl-h open 'replace' dialogue * set 'replace unit' to 'Line' click 'advanced' tab: * set 'run following at the begin' to: * set 'run following for each ..': * set 'insert end text': 3. click 'replace', the first part is done. 4. ctrl-h open 'replace' dialogue again * set 'replace unit' to 'Line' * set 'replace with pattern': click 'advanced' tab: * set 'run following at the begin': * set 'run following for each ..': * set 'insert end text': 5. click 'replace' |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |