Hi guys,

Can anyone help me with the following question? I am new to Shell Scripting and havent a clue how to use it. This is for a job I have applied for and i have never needed to use linux and have always been a Windows man. I probably shouldnt be saying that on a Linux forum :p but if anyone could help me out I would be so grateful.

Also if you could explain it a little bit that would also be great

Thanks

"Q4. A text file contains a list of numbers, one per line. Write a program that will print out 5 most commonly occurring numbers, one per line, without surrounding whitespace, in descending order. Assume that the numbers are contained in a file called numbers.txt =="

Bad disguise of a homework question if, you ask me. So, do your own homework.

As a hint, look at the man pages for the command sort. Then use a for loop, a counter variable, if, and echo (in that order).

Thanks for the hint. First things first. This isnt homework and if i knew where to look to do my own homework i wouldnt have posted...? This is genuinely for a job.

Again i sincerely thank you for the help, but less of the sarcasm.

"Q4. A text file contains a list of numbers, one per line. Write a program that will print out 5 most commonly occurring numbers, one per line, without surrounding whitespace, in descending order. Assume that the numbers are contained in a file called numbers.txt =="

Thanks for the hint. First things first. This isnt homework and if i knew where to look to do my own homework i wouldnt have posted...? This is genuinely for a job.

Again i sincerely thank you for the help, but less of the sarcasm.

I'm sorry (maybe not), but what kind of job "interview", "application", or whatever, has the above quoted question. Have never seen, or heard of this sort of thing. And, even if it is some sort of job application that has this, giving a full solution to the question still amounts to the same thing, cheating. Only, in the case that it is truly some sort of job application, it is even worse than cheating on homework, as it would help to get you a job for which you would not be qualified. That, as I said, is even worse than cheating on homework.

This article has been dead for over six months. Start a new discussion instead.