Posts Tagged ‘directory ls’

How to count duplicate the lines of a file by using Linux Shell Programming?

Hi,

I’m new to linux and to shell programming. I have an assignment to create a shell script that shows all the folders, sub folders and files of the current directory. LS does this. But I must count how many duplicate lines each file has, and show the line that is repeated the most times in each file.

I really have no idea where to start. How can I read/compare lines within a file?

Thanks in advance!