Sponsored Content
Top Forums Shell Programming and Scripting Hostname lookup and create text file Post 302893574 by gubbu on Thursday 20th of March 2014 01:46:29 AM
Old 03-20-2014
Hostname lookup and create text file

I have a list of hostnames in a txt file . I need to do nslookup or other command on linux and get the ip address and if you dont find an ip address then put 0.0.0.0 instead in the output text file along with the hostname.

So input
Code:
host1
host2
host2.dd.ddd.net

Output
Code:
host1, 10.136.21.2
host2,10.127.1.2
host2.dd.ddd.net,0.0.0.0

thanks
G

Last edited by Scott; 03-20-2014 at 05:31 AM.. Reason: CODE tags instead of ICODE tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

getting particular text after grep from lookup file

Hi I have two files a1 and b1 a1 has the following job names ab cd ef b1 has the following job details /*----------- ji -----------------*/ asdasd fgd saas dfdf asas fd gfg /*---------- ab ----------------*/ ara jhk dfhk asjla condition: s(abc_wf_hi) (10 Replies)
Discussion started by: napolayan
10 Replies

2. UNIX for Advanced & Expert Users

Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help

Write a quick shell snippet to find all of the IPV4 IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files. Perform a reverse lookup on each, and format the output neatly, like "IP=192.168.0.1, ... (0 Replies)
Discussion started by: choco4202002
0 Replies

3. AIX

How to create short name for hostname

Such as one hostname: abcd1234, how to create a short name: a1? (4 Replies)
Discussion started by: rainbow_bean
4 Replies

4. Shell Programming and Scripting

Create multiple text file from a single text file on AIX

Hi I need to create multiple text files from onc text file on AIX. The data of text files is as below: ********************************************** ********************************************** DBVERIFY: Release 10.2.0.4.0 - Production on Tue Nov 10 13:45:42 2009 Copyright (c) 1982,... (11 Replies)
Discussion started by: lodhi1978
11 Replies

5. UNIX for Dummies Questions & Answers

Script to create text file.

Hi all Below this is my script..I want to write the command to create a text file in my script below. If anyone know how to do...show me the result.I also want to do this script run automatically without type in terminal. Thanks. #!/usr/bin/sh... (6 Replies)
Discussion started by: mastercar
6 Replies

6. Red Hat

create pdf of text file help

Can someone please tell me why this is not working? I have created numerous pdf's from text files by following these instructions and this time it is not working. Convert jpeg files to PDF under Linux | bitPrison.net convert /home/liveuser/Documents/hw7 /home/liveuser/Documents/hw7.pdf... (5 Replies)
Discussion started by: cokedude
5 Replies

7. Shell Programming and Scripting

Script to create a text file whose content is the text of another files

Hello everyone, I work under Ubuntu 11.10 (c-shell) I need a script to create a new text file whose content is the text of another text files that are in the directory $DIRMAIL at this moment. I will show you an example: - On the one hand, there is a directory $DIRMAIL where there are... (1 Reply)
Discussion started by: tenteyu
1 Replies

8. Shell Programming and Scripting

Bash script to replace text file from a lookup file

Hi. I need assistance with the replacing of text into a specific file via a bash script. My bash script, once run, currently provides a menu of computer names to choose.The script copies onto my system various files, depending what computer was selected in the menu.This is working OK. Now, I... (1 Reply)
Discussion started by: jonesn2000
1 Replies

9. Shell Programming and Scripting

Splitting a text file into smaller files with awk, how to create a different name for each new file

Hello, I have some large text files that look like, putrescine Mrv1583 01041713302D 6 5 0 0 0 0 999 V2000 2.0928 -0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 5.6650 0.2063 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0 3.5217 ... (3 Replies)
Discussion started by: LMHmedchem
3 Replies

10. Shell Programming and Scripting

Create a text file and a pdf file from Linux command results.

Hello. The task : Using multiple commands like : gdisk -l $SOME_DISK >> $SOME_FILEI generate some text file. For readiness I must insert page break. When the program is finished I want to convert the final text file to a pdf file. When finished, I got two files : One text file and One pdf... (1 Reply)
Discussion started by: jcdole
1 Replies
ethers(5)							File Formats Manual							 ethers(5)

Name
       ethers - database that maps Ethernet addresses to hostnames

Description
       The  file  is used in conjunction with the reverse address resolution protocol daemon, to map Ethernet addresses to hostnames.  It contains
       information about the known (48-bit) Ethernet addresses of hosts on the Internet.

       For each host on an Ethernet, a single line should be present in the file with the following information:

       Ethernet-address        official-host-name

       Items are separated by one or more spaces or tabs.  A number sign (#) indicates the beginning of a comment that extends to the end of line.

       The standard form for Ethernet addresses is:

       x:x:x:x:x:x

       The x is a hexadecimal number between 0 and ff, representing 1 byte.  The address bytes are always in network order.

       Hostnames can contain any printable character other than a space, tab, newline, or number sign (#).

       Hostnames in the file should correspond to the hostnames in the file or to those provided by the name service.

Examples
       The following is a sample file: 08:00:20:01:e5:1c       host1	    # Comments go here 08:00:20:01:d0:4c       host2	    # Comments	go
       here 08:00:20:01:e0:1d	    host3	 # Comments go here 08:00:20:00:c2:4e	    host4	 # Comments go here

See Also
       ethers(3n), hosts(5), rarpd(8c)
       Introduction to Networking and Distributed System Services

																	 ethers(5)
All times are GMT -4. The time now is 04:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy