[HPADM] RE: Re: script question - simplified - with file format

From: SARANGI, ABANI RANJAN (abani.ranjan@hp.com)
Date: Wed Jun 09 2004 - 23:44:52 EDT


Hi Balaji,
     try this if this helps..
 
#for i in `cat xyz`
>do
>j=`nslookup $i |grep Name |cut -f2 -d:`
>echo $i $j >> abc
>done
#
 
 
  where xyz is the file having the ip addresses in column and abc will
be the file of " ip name"
 
 
thanks and regards,
     Abani

-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl
[mailto:hpux-admin-owner@DutchWorks.nl] On Behalf Of Balaji Nathan
Sent: Thursday, June 10, 2004 2:07 AM
To: hpux-admin@DutchWorks.nl
Subject: [HPADM] Re: script question - simplified - with file format

Hi admins,
I think I should simplify the question.
I have a configuration text file with the contents like below:
NETADDRESS=192.168.100.170
NETADDRESS=172.16.40.40

I would like to replace the ip addresses with the name. (DNS)
Please help.

Balaji Nathan <balajinathan2003@yahoo.com> wrote:

Hi Admins,
I need your help on the following.
I have a file (file1) with IP addresses (of the workstations)
The idea is to replace the ip addresses with names.
I am thinking:
a. Get a list of ip addresses from the file1 and call the new file as
file2
   do a nslookup on the content of file2 and create a file called file3
    and some how I have to have two columns on file3 like
    
    192.168.30.100 workstation1
    I do not know how to create the above format file (with two columns)
 
b. Based on file3,I have to search and replace ip addresses with names
on file1.
    In other words, using file3 contents, search a match for column1 (ip
addresses) on file1 and replace with corresponding column 2 name.
Is this doable?
Please help.

  _____

Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! <http://messenger.yahoo.com/>
Messenger

  _____

Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! <http://messenger.yahoo.com/>
Messenger

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:41 EDT