LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to find duplicate entries in shell (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-duplicate-entries-in-shell-628658/)

jyotijain21 03-17-2008 08:41 AM

How to find duplicate entries in shell
 
I want to find the duplicate entries in file in shell.
for example:
cat file.txt
23
45
45
1
23
24

thn the output gve me:

45
23

means entries which are duplicate

acid_kewpie 03-17-2008 09:19 AM

looks a lot like homework, but check out the uniq and sort commands.

jimbo1708 03-17-2008 10:07 AM

look at the documentation for sed...

- JB

jyotijain21 03-18-2008 02:31 AM

cn smebody gve me exact solution... i tried with uniq and sort.. bt unable to do

konsolebox 03-18-2008 02:50 AM

Code:

cat file.txt | sort | uniq -d

jyotijain21 06-23-2008 02:17 AM

my file contains text like
user,friends,college

now i want delimiter after user
which will gve output like

friends,college


All times are GMT -5. The time now is 12:53 AM.