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.
Reply
 
Thread Tools Display Modes
  #1  
Old 16th March 2011, 06: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
  #2  
Old 8th July 2011, 01:01
alleks alleks is offline
Senior Member
 
Join Date: Nov 2010
Posts: 157
Thanks: 9
Thanked 9 Times in 9 Posts
Default

Start with searching google also and checking out these results

http://www.linuxquestions.org/questi...a-file-617441/

http://unstableme.blogspot.com/2008/...ting-file.html
Reply With Quote
  #3  
Old 13th July 2011, 15:17
gerr1t gerr1t is offline
Junior Member
 
Join Date: Jul 2010
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
 
Default

cat filename | sort | uniq -c

Good luck
Reply With Quote
Reply

Bookmarks

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 17:25
Email problem 'Cannot set my user or group id.' (using ISPConfig 3 + OpenSuSE 11.2) urosm Installation/Configuration 5 19th June 2010 22:41
Can't access to my website - after install problem pallermo Installation/Configuration 18 4th June 2010 13:29
drbd error -115 anandx Installation/Configuration 15 26th April 2009 19:16
Dspam planet_fox General 6 20th January 2007 18:42


All times are GMT +2. The time now is 12:41.


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