How to find frequent occurance of a word in a line?

File_source.DAT
1|abc|abc|abc|abc|abc
2|abc|abc|efg|efg|def
3|abc|bcd|cde|def|efg
4|abc|abc|abc|def|efg

Please help me to solve this as below using UNIX.

File_output.DAT
"1"|"abc" - as abc is the most occured in this line
"2"|"NOT DETERMINED"- abc and efg both repeted twice
"3"|"NOT DETERMINED"- as all are distinct
4|abc - as abc is the most occured in this line

home work :frowning:

what you tried so far ?

i tried counting the strings, but not able to imply 2,3 and the comparisons in between..is there any function equivalent to handle.

it will be gr8 if you could share what you have tried in commands :slight_smile: we can help you to proceed...