what the best way to find duplicate IP from file ( I have ksh script in this script I need to write function that check for duplicate IP )for example if IP - 192.1926.23.52  exists twice in file - config_IP.txtthen need to print duplicate IP - xxx.xxx.xxx.xxxsolution can be with ksh or perl one liner , sed ,awk etcthe format of the file should be as the following:more config_IP.txt # NETWORK adminstration 192.192.23.150 192.192.23.120 192.192.23.152 192.192.23.52       192.192.23.153 192.192.23.53       192.192.23.154 192.192.23.54       #NETWORK private 192.192.23.170  192.192.23.122          192.192.23.172  192.192.23.126   192.192.23.174  192.192.23.123      192.192.23.177  192.192.23.121  # NETWORK oracle internal152.3.4.12 152.3.4.12 152.3.4.14 152.3.4.16 # NETWORK oracle ext152.3.4.10 152.3.4.19 
linux/solaris + verify duplicate valid IP address from file
shell script;sed;awk;perl;ksh
Something like this (Assuming you want to check for IP against the entire file, not just against the one present in the same line):awk '/^[0-9]/{for(i=1;i<=NF;i++)if(a[$i]++==1) print Duplicate IP : ,$i;}' file