Sponsored Content
Full Discussion: Question relate to AWK
Top Forums UNIX for Advanced & Expert Users Question relate to AWK Post 302189307 by beeloo on Friday 25th of April 2008 11:52:55 AM
Old 04-25-2008
Question relate to AWK

Hi,

I would like to setup a FOR loop script to find out all the existing linux workstation in the network w/ ip address, hostname and linux version.

I created a basic FOR loop script:

for i in $(seq 1 254)
do
echo 10.72.169.$i >> result
ssh -o ConnectTimeout=3 root@10.72.169.$i "hostname" >> result
ssh -o ConnectTimeout=3 root@10.72.169.$i "cat /etc/redhat-release" >> result
done


However, the output is like this:

.
.
10.72.169.21
lumines.devo.ilx.com
Fedora Core release 5 (Bordeaux)
10.72.169.22
10.72.169.23
10.72.169.24
copper.devo.ilx.com
10.72.169.25
frogger.devo.ilx.com
Fedora Core release 5 (Bordeaux)
10.72.169.26
afterlife.devo.ilx.com
Red Hat Linux release 9 (Shrike)
10.72.169.27
10.72.169.28
molybdenum
Red Hat Linux release 9 (Shrike)
10.72.169.29
Red Hat Linux release 7.2 (Enigma)
10.72.169.30
.
.
.

I want the output to be like :

10.72.169.21 lumines.devo.ilx.com Fedora Core release 5 (Bordeaux)
10.72.169.22 abc.devo.ilx.com Fedora Core release 5 (Bordeaux)
.
.

I think with the command AWK, i can do that. But I don't know how to make it to work. Can someone show it to me?

Thanks
BEELOO
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another Awk Question! ;)

The variable "NF" holds the number of fields on the current record. Is there a variable that returns the current field within the record being processed? Given a record of "n" fields (variable number of fields for a given record), how can you tell which field you are actually on when you match a... (5 Replies)
Discussion started by: google
5 Replies

2. Shell Programming and Scripting

awk .. question?

i have a little awk script that I use looks this: awk '{if (FNR==1){print FILENAME; print $0}else print $0}' file1...file2....fi... > bundled. i have completely forgotten how to unbundle this. I have tried several different approaches and still can not remember how to unbundle the file bundled.... (2 Replies)
Discussion started by: moxxx68
2 Replies

3. HP-UX

question on awk

i have bench of files and i have archeive in different names FOR EX: the files come in the directory as 1111_2222_3333_4444_5555_6666_7777.dat.xls.ZIP XXXX_VVVV_3333_4444_5555_6666_7777.dat.xls.ZIP I have to select the files from 4 th position to last position and concaTENATE THEM ... (1 Reply)
Discussion started by: r_satya7
1 Replies

4. Shell Programming and Scripting

Need to relate Radius log entries to DHCP ones

Hi, let say i have 2 log files(they are below) dhcp and radius. What i need is to put the information to a file just from good connections ( Auth: Login OK ) others just ignore. And the information should look like: time, login name, mac, ip, server. But the trouble is that from radius log i get... (10 Replies)
Discussion started by: wrwe
10 Replies

5. UNIX for Dummies Questions & Answers

Basic awk question...getting awk to act on $1 of the command itself

I have a script problem that I am not able to solve due my very limited understanding of unix/awk. This is the contents of test.sh awk '{print $1}' From the prompt if I enter: ./test.sh Hello World I would expect to see "Hello" but all I get is a blank line. Only then if I enter "Hello... (2 Replies)
Discussion started by: JasonHamm
2 Replies

6. Solaris

I have LUN ID, how to find disk relate to that LUN ID?

I have a list of LUN ID, my task is to find if disk has been added or not. How do I do that? I have been searching the forum and not able to find answer. thanks (4 Replies)
Discussion started by: uuontario
4 Replies

7. Programming

help with C++ code that relate the object with physical address

I need some help to write a C++ code that read and write the register of a sequencer. I have to make a code that relate the objects with the physical address but I am a bit confuse. Could someone suggest me how to proceed? in which parts do I split the code? thanks (1 Reply)
Discussion started by: silviafisica
1 Replies

8. Shell Programming and Scripting

question about awk

Mike Harrington:(510) 548-1278:250:100:175 Christian Dobbins:(408) 538-2358:155:90:201 Susan Dalsass:(206) 654-6279:250:60:50 Archie McNichol:(206) 548-1348:250:100:175 Jody Savage:(206) 548-1278:15:188:150 Guy Quigley:(916)... (4 Replies)
Discussion started by: JA50
4 Replies

9. Shell Programming and Scripting

awk question : system output to awk variable.

Hi Experts, I am trying to get system output to capture inside awk , but not working: Please advise if this is possible : I am trying something like this but not working, the output is coming wrong: echo "" | awk '{d=system ("date") ; print "Current date is:" , d }' Thanks, (5 Replies)
Discussion started by: rveri
5 Replies

10. UNIX for Advanced & Expert Users

How to relate ipcs id or cpid to process?

Hi, we have multiple database instances running on solaris server like db1, db2 and db3. Below shown ipcs -pmb shared memory segment output. Using cpid value I want to relate to the database instances db1, db2 and db3. Please let me know how to do this? $ ipcs -pmb IPC status from <running... (9 Replies)
Discussion started by: baladelaware73
9 Replies
SYSTEMD.DNSSD(5)						   systemd.dnssd						  SYSTEMD.DNSSD(5)

NAME
systemd.dnssd - DNS-SD configuration SYNOPSIS
network_service.dnssd DESCRIPTION
DNS-SD setup is performed by systemd-resolved(8). The main network service file must have the extension .dnssd; other extensions are ignored. The .dnssd files are read from the files located in the system network directory /usr/lib/systemd/dnssd, the volatile runtime network directory /run/systemd/dnssd and the local administration network directory /etc/systemd/dnssd. All configuration files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same name in /lib. This can be used to override a system-supplied configuration file with a local file if needed. Along with the network service file foo.dnssd, a "drop-in" directory foo.dnssd.d/ may exist. All files with the suffix ".conf" from this directory will be parsed after the file itself is parsed. This is useful to alter or add configuration settings, without having to modify the main configuration file. Each drop-in file must have appropriate section headers. In addition to /etc/systemd/dnssd, drop-in ".d" directories can be placed in /usr/lib/systemd/dnssd or /run/systemd/dnssd directories. Drop-in files in /etc take precedence over those in /run which in turn take precedence over those in /lib. Drop-in files under any of these directories take precedence over the main network service file wherever located. (Of course, since /run is temporary and /usr/lib is for vendors, it is unlikely drop-ins should be used in either of those places.) [SERVICE] SECTION OPTIONS The network service file contains a "[Service]" section, which specifies a discoverable network service announced in a local network with Multicast DNS broadcasts. Name= An instance name of the network service as defined in the section 4.1.1 of RFC 6763[1], e.g. "webserver". The option supports simple specifier expansion. The following expansions are understood: Table 1. Specifiers available +----------+----------------+-------------------------------------+ |Specifier | Meaning | Details | +----------+----------------+-------------------------------------+ |"%m" | Machine ID | The machine ID of the running | | | | system, formatted as string. See | | | | machine-id(5) for more information. | +----------+----------------+-------------------------------------+ |"%b" | Boot ID | The boot ID of the running system, | | | | formatted as string. See random(4) | | | | for more information. | +----------+----------------+-------------------------------------+ |"%H" | Host name | The hostname of the running system. | +----------+----------------+-------------------------------------+ |"%v" | Kernel release | Identical to uname -r output. | +----------+----------------+-------------------------------------+ Type= A type of the network service as defined in the section 4.1.2 of RFC 6763[1], e.g. "_http._tcp". Port= An IP port number of the network service. Priority= A priority number set in SRV resource records corresponding to the network service. Weight= A weight number set in SRV resource records corresponding to the network service. TxtText= A whitespace-separated list of arbitrary key/value pairs conveying additional information about the named service in the corresponding TXT resource record, e.g. "path=/portal/index.html". Keys and values can contain C-style escape sequences which get translated upon reading configuration files. This option together with TxtData= may be specified more than once, in which case multiple TXT resource records will be created for the service. If the empty string is assigned to this option, the list is reset and all prior assignments will have no effect. TxtData= A whitespace-separated list of arbitrary key/value pairs conveying additional information about the named service in the corresponding TXT resource record where values are base64-encoded string representing any binary data, e.g. "data=YW55IGJpbmFyeSBkYXRhCg==". Keys can contain C-style escape sequences which get translated upon reading configuration files. This option together with TxtText= may be specified more than once, in which case multiple TXT resource records will be created for the service. If the empty string is assigned to this option, the list is reset and all prior assignments will have no effect. EXAMPLES
Example 1. HTTP service # /etc/systemd/dnssd/http.dnssd [Service] Name=%H Type=_http._tcp Port=80 TxtText=path=/stats/index.html t=temperature_sensor This makes the http server running on the host discoverable in the local network given MulticastDNS is enabled on the network interface. Now the utility "systemd-resolve" should be able to resolve the service to the host's name: $ systemd-resolve --service meteo._http._tcp.local meteo._http._tcp.local: meteo.local:80 [priority=0, weight=0] 169.254.208.106%senp0s21f0u2u4 fe80::213:3bff:fe49:8aa%senp0s21f0u2u4 path=/stats/index.html t=temperature_sensor (meteo/_http._tcp/local) -- Information acquired via protocol mDNS/IPv6 in 4.0ms. -- Data is authenticated: yes "Avahi" running on a different host in the same local network should see the service as well: $ avahi-browse -a -r + enp3s0 IPv6 meteo Web Site local + enp3s0 IPv4 meteo Web Site local = enp3s0 IPv6 meteo Web Site local hostname = [meteo.local] address = [fe80::213:3bff:fe49:8aa] port = [80] txt = ["path=/stats/index.html" "t=temperature_sensor"] = enp3s0 IPv4 meteo Web Site local hostname = [meteo.local] address = [169.254.208.106] port = [80] txt = ["path=/stats/index.html" "t=temperature_sensor"] SEE ALSO
systemd(1), systemd-resolved.service(8) NOTES
1. RFC 6763 https://tools.ietf.org/html/rfc6763 systemd 237 SYSTEMD.DNSSD(5)
All times are GMT -4. The time now is 02:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy