The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reverse FTP ganesh123 Shell Programming and Scripting 4 02-22-2007 02:20 PM
Reverse * azmathshaikh Shell Programming and Scripting 2 04-26-2005 07:40 AM
Reverse lookup jpalmer320 IP Networking 1 05-21-2004 09:36 AM
reverse lookup again Westy564 IP Networking 1 01-12-2004 11:37 AM
reverse lookup file problem Westy564 IP Networking 2 01-09-2004 02:55 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-26-2008
snake450 snake450 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 5
Reverse DNS problem

Hi everyone,

I am having a problem in the following area:

I want to arrange list of Ip Addresses selected from a multiple files and make it look like this:

"IP=192.168.0.1, hostname=snake.cooliris.com"

Now i have already written the code to select the ip address from various files but want this part to be working.

Thanks a lot.
  #2 (permalink)  
Old 08-26-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,421
Quote:
Originally Posted by snake450 View Post
Now i have already written the code to select the ip address from various files but want this part to be working.
And where is your code and where is the problem?
Whitout the code we can't tell you where the problem is!
  #3 (permalink)  
Old 08-26-2008
snake450 snake450 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 5
Hey ,
my logic was to get as many file sin as possible so here is the half part of the code

Please correct me if i am wrong.

grep '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' followed by respective file names which lies under /var/lib/output/ for me atleast.

Now i want to write the code for reverse dns here .....am i on the right path?

I just wanted to add that i know the commands for reverse dns is Nslookup or dig -x followed by the ip address but the thing how do i make to take the ip address from various files and format it.

Last edited by snake450; 08-26-2008 at 08:28 PM..
  #4 (permalink)  
Old 08-26-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,421
Quote:
Originally Posted by snake450 View Post
Please correct me if i am wrong.

grep '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' followed by
Your regexp will match anything upto 999.999.999.999

For IPv4 try this awk solution:
Code:
awk -F'.' 'NF==4 && $1 > 0 && $1 && $2 && $3 && $4 <256'
If IP match use the system function to dig your ip and printf to format the output.

Regards,
  #5 (permalink)  
Old 08-26-2008
snake450 snake450 is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 5
Hey thanks for the reply but i am not aware how to use the system function to dig my ip from the previous result.....can you enlighten me on that part cause i am having a tough time figuring out how to make the function grab the ip from the grep expression and give it to the reverse dns process.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0