![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| check ssh connection to remote host | praveenbvarrier | Shell Programming and Scripting | 6 | 1 Day Ago 09:46 AM |
| Duplicate crontab entries | vikashtulsiyan | SUN Solaris | 2 | 05-06-2008 02:07 AM |
| Bash Script to check Remote Host Connection | zulfikarmd | UNIX for Dummies Questions & Answers | 5 | 04-16-2008 03:53 AM |
| Filtering multiple entries in a file | suman_jakkula | Shell Programming and Scripting | 2 | 08-22-2006 02:02 AM |
| deleting double entries in a log file | opusforum | Shell Programming and Scripting | 5 | 09-17-2002 12:02 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Check host file for duplicate entries
I need a KSH script that will check a host file for duplicate IP's and/or host names and report out the errors. Anyone out there have one they would like to share?
Something like: Hostname blahblah appears X times IP Address xxx.xxx.xxx.xxx appears X times TIA |
| Forum Sponsor | ||
|
|
|
|||
|
Hacking a previous post, something along the lines of
for i in `cat /etc/hosts | cut -d"." -f1,2 | uniq` do num=`cat /etc/hosts | grep $i | wc -l` if (( $num > 1 )) then echo $i fi done which will show you the IP address that have duplicates I think, just needs polishing off with a ''wc' command ? - someone please confirm - digging up my script memories! ------------------------------------------------------------------- ~ stevie Solaris SCSA (v8) Microsoft MCP Ubuntu & Fedora on-the-way |