Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using AWK for ping and print.. Post 84965 by vgersh99 on Thursday 29th of September 2005 06:04:17 PM
Old 09-29-2005
Code:
#!/bin/ksh

hosts='/etc/hosts'

while read ip host theRest
do
   ping "${ip}" 1>/dev/null 2>&1
   [[ "${?}" -eq 0 ]] && echo "${ip} is alive ${host} ${theRest}" || echo "${ip} is dead ${host} ${theRest}"
done < "${hosts}"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I get awk to print a " in it's print part?

The line is simple, use " '{ print $1"]"$2"\"$3THE " NEEDS TO GO HERE$4 }' I've tried \", "\, ^" and '"" but none of it works. What am I missing? Putting in the [ between $1 and $2 works fine, I just need to do the same with a ". Thanks. (2 Replies)
Discussion started by: LordJezo
2 Replies

2. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

3. Shell Programming and Scripting

Help with Ping Script and AWK

Hey Guys, First time posting here. I keep getting back here on my google searches to help me in my scripting quest. Can i ask for some guidance please? I acquired a script, from these forums in fact that pings a list of IPs/Hostnames. Works a treat. Echos results to a file with the value... (3 Replies)
Discussion started by: stacky69
3 Replies

4. Shell Programming and Scripting

Router ping log extract data from it Awk/Sed/grep

Hi, I am new to this world.. Using expect i loging to router and checking ping response to my links. I need to genarate report using this output and that report contains only three file link name, packet loss, latency. my output of script is like below: -bash-3.00$ monmw/mwbkp... (2 Replies)
Discussion started by: jkmistry
2 Replies

5. Shell Programming and Scripting

Animation Ping on Solaris Like Cisco Ping

Hi, I develop simple animation ping script on Solaris Platform. It is like Cisco ping. Examples and source code are below. bash-3.00$ gokcell 152.155.180.8 30 Sending 30 Ping Packets to 152.155.180.8 !!!!!!!!!!!!!.!!!!!!!!!!!!!!!. % 93.33 success... % 6.66 packet loss...... (1 Reply)
Discussion started by: gokcell
1 Replies

6. Shell Programming and Scripting

Awk: Print count for column in a file using awk

Hi, I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1). Input: 919143110065 919143110065 919143110052 918648846132 919143110012 918648873782 919143110152 919143110152 919143110152... (2 Replies)
Discussion started by: siramitsharma
2 Replies

7. Shell Programming and Scripting

Need shell script to Telnet multiple node , Ping some IP and print output

Hi Team, Need shell script to Telnet multiple node , Ping some IP and print output like pass or fail. Need this script to check reachability of multiple nodes at same time. Help me. I use this but not working... Eg. in this script i need to telnet... (4 Replies)
Discussion started by: Ganesh Mankar
4 Replies

8. UNIX and Linux Applications

Script help with awk/ping

I need to ping a host website ...like facebook.com and out the seconds of delay for 5 websites ..I need help writing a script that will print the bold PING facebook.com (173.252.90.36) 56(84) bytes of data. 64 bytes from edge-star-mini-shv-13-atn1.facebook.com (173.252.90.36): icmp_req=1... (1 Reply)
Discussion started by: 5sku5
1 Replies

9. Programming

Ping test sends mail when ping fails

help with bash script! im am working on this script to make sure my server will stay online, so i made this script.. HOSTS="192.168.138.155" COUNT=4 pingtest(){ for myhost in "$@" do ping -c "$COUNT" "$myhost" &&return 1 done return 0 } if pingtest $HOSTS #100% failed... (4 Replies)
Discussion started by: mort3924
4 Replies

10. Shell Programming and Scripting

awk Pattern Matching for PING tests

I have a script that logs into a server and pings several other servers in order to verify IP path between servers. The output can look like this, if good pings: Response from 1.1.1.4;_id=0, vlan_prio=0): seq=0 time=91.547 ms. Response from 1.1.1.4;_id=0, vlan_prio=0): seq=1 time=61.176 ms.... (7 Replies)
Discussion started by: he204035
7 Replies
ARPSPOOF(8)						      System Manager's Manual						       ARPSPOOF(8)

NAME
arpspoof - intercept packets on a switched LAN SYNOPSIS
arpspoof [-i interface] [-c own|host|both] [-t target] [-r] host DESCRIPTION
arpspoof redirects packets from a target host (or all hosts) on the LAN intended for another host on the LAN by forging ARP replies. This is an extremely effective way of sniffing traffic on a switch. Kernel IP forwarding (or a userland program which accomplishes the same, e.g. fragrouter(8)) must be turned on ahead of time. OPTIONS
-i interface Specify the interface to use. -c own|host|both Specify which hardware address t use when restoring the arp configuration; while cleaning up, packets can be send with the own address as well as with the address of the host. Sending packets with a fake hw address can disrupt connectivity with certain switch/ap/bridge configurations, however it works more reliably than using the own address, which is the default way arpspoof cleans up afterwards. -t target Specify a particular host to ARP poison (if not specified, all hosts on the LAN). Repeat to specify multiple hosts. -r Poison both hosts (host and target) to capture traffic in both directions. (only valid in conjuntion with -t) host Specify the host you wish to intercept packets for (usually the local gateway). SEE ALSO
dsniff(8), fragrouter(8) AUTHOR
Dug Song <dugsong@monkey.org> ARPSPOOF(8)
All times are GMT -4. The time now is 03:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy