Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Old 16th March 2011, 07:59
Gregoryfried Gregoryfried is offline
Junior Member
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to count duplicate the lines of a file by using Linux Shell Programming?

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!
lean muscle x
Reply With Quote
Sponsored Links
Old 8th July 2011, 02:01
alleks alleks is offline
Senior Member
Join Date: Nov 2010
Posts: 157
Thanks: 9
Thanked 9 Times in 9 Posts

Start with searching google also and checking out these results


Reply With Quote
Old 13th July 2011, 16:17
gerr1t gerr1t is offline
Junior Member
Join Date: Jul 2010
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post

cat filename | sort | uniq -c

Good luck
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Being Spammed/Hacked/Probed not sure PLEASE HELP! kresser General 10 29th October 2010 18:25
Email problem 'Cannot set my user or group id.' (using ISPConfig 3 + OpenSuSE 11.2) urosm Installation/Configuration 5 19th June 2010 23:41
Can't access to my website - after install problem pallermo Installation/Configuration 18 4th June 2010 14:29
drbd error -115 anandx Installation/Configuration 15 26th April 2009 20:16
Dspam planet_fox General 6 20th January 2007 19:42

All times are GMT +2. The time now is 03:25.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.