LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-12-2008, 12:21 PM   #1
avklinux
Member
 
Registered: Nov 2008
Posts: 32

Rep: Reputation: 15
Shell Script : Finding a duplicate Number from file ?


Thanks
AVK linux
 
Old 12-12-2008, 01:12 PM   #2
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
You should probably elaborate on your question. atleast write your question in the post!

Last edited by w3bd3vil; 12-12-2008 at 01:14 PM.
 
Old 12-12-2008, 04:26 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
you REALLY aren't making any friends with your multiple accounts and hopelessly vague threads. If you wish to remain a valued member of this site, please use it better.
 
Old 12-14-2008, 01:33 AM   #4
arunmathew1984
Member
 
Registered: Nov 2008
Posts: 31

Rep: Reputation: 15
Can you elaborate a bit more on your requirements!!!

Linux Archive

Last edited by arunmathew1984; 12-20-2008 at 11:24 AM.
 
Old 12-14-2008, 02:45 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
dude, he's been asked twice already, and is probably never coming back to this thread... why bump it??
 
Old 12-15-2008, 12:14 PM   #6
avklinux
Member
 
Registered: Nov 2008
Posts: 32

Original Poster
Rep: Reputation: 15
Hello Thread

Hello ,

i got some comments like i am not using this site in a better way . ?

Moderator can you explain what is my mistake ?

i will not repeat if its really violating the forum policy


Thanks

And iN a question i want ask :

In bash , how can i find a duplicate number from one file .

ex :
file or variable has a following value
1
2
3
4
5
5


so how can i find a duplicate number with shell script in bash.

Thanks
AVKlinux
 
Old 12-15-2008, 12:27 PM   #7
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
sort file_to_find_dupes | uniq -d
 
Old 12-15-2008, 01:10 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
well no need to use uniq at all, sort has a unique option too, -u i *think*.

and bgeddy, please sort out your signature, it's horrible and is distorting the page layouts from all the -'s
 
Old 12-16-2008, 11:50 AM   #9
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 227Reputation: 227Reputation: 227
Unhappy

Quote:
well no need to use uniq at all, sort has a unique option too, -u i *think*.
Well I took it the OP wanted to output duplicates only so first sort the file then pass it to uniq -d to output duplicates only. Sorting unique just fives a unique list of values.

Quote:
and bgeddy, please sort out your signature, it's horrible and is distorting the page layouts from all the -'s
Sorry about that - ( it's never been mentioned before). Hopefully it's now OK ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I compare floating number in a shell script? abefroman Programming 29 09-10-2012 11:29 AM
Finding duplicate lines in a file MikeyCarter Linux - Software 3 10-05-2008 05:28 PM
Urgent - Duplicate Script File Colly McKenna Linux - Newbie 8 03-16-2006 01:18 AM
Finding a shell script une Programming 5 01-26-2005 05:23 AM
Finding a shell script une Linux - General 2 01-26-2005 01:33 AM


All times are GMT -5. The time now is 11:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration