Sponsored Content
Full Discussion: Script help with awk/ping
Special Forums UNIX and Linux Applications Script help with awk/ping Post 302961941 by 5sku5 on Sunday 6th of December 2015 11:58:45 PM
Old 12-07-2015
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 ttl=76 time=74.0 ms

--- facebook.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 74.087/74.087/74.087/0.000 ms
PING pbs.org (23.21.237.247) 56(84) bytes of data.

Code:
for websites in `cat hosts`

do
ping -c 1 $websites >> pingwebsites


echo "Please wait. Waiting to find the host with the highest delay !!!--->"

 awk ' { print $2,  $8 } ' pingwebsites >pingtimes

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using AWK for ping and print..

I'm using a hosts file, formatted like this: xxx.xxx.xxx.xxx dnsname #comment Current command is: for host in 'awk '/^/ { print $1 }' etc/hosts' do ping $host 1 2>&1 | \ sed 's/.*no answer.*/[31;1m&[0m/;s/.*is alive.*/[32;2m[0m/' done (no... (5 Replies)
Discussion started by: hutch770
5 Replies

2. Shell Programming and Scripting

Ping Script

hello, I am looking to make a script that will ping a remote ip address. Upon completion of the ping I want the program to either ping again if the # of packets transmitted is equal to the number of packets received or exit if the two values are unequal and information was lost. I am not sure if I... (3 Replies)
Discussion started by: mcrosby
3 Replies

3. Shell Programming and Scripting

Ping script

I want find from a file , where list of hosts is given . Whether SSH is running on that Hosts and and create 2 files : HOSt-SSH-Running HOST-SSH-Not-running In the list we have some Windows and Unix Servers, windows servers do not have sshd running. (2 Replies)
Discussion started by: sriram003
2 Replies

4. 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

5. Shell Programming and Scripting

Help With Ping Script

Hello all...I'm new to Unix and learning. What I'm trying to create is a script that will ping a known range of IP addresses, say 192.168.1.1 to 192.168.1.254. For each address that no reply is received, that address will be written to a log file that will be emailed to an administrator. My wife... (1 Reply)
Discussion started by: spmitchell
1 Replies

6. 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

7. 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

8. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 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
Simple action in tc(8)                                                 Linux                                                Simple action in tc(8)

NAME
simple - basic example action SYNOPSIS
tc ... action simple [ sdata STRING ] [ index INDEX ] [ CONTROL ] CONTROL := { reclassify | pipe | drop | continue | ok } DESCRIPTION
This is a pedagogical example rather than an actually useful action. Upon every access, it prints the given STRING which may be of arbi- trary length. OPTIONS
sdata STRING The actual string to print. index INDEX Optional action index value. CONTROL Indicate how tc should proceed after executing the action. For a description of the possible CONTROL values, see tc-actions(8). EXAMPLES
The following example makes the kernel yell "Incoming ICMP!" every time it sees an incoming ICMP on eth0. Steps are: 1) Add an ingress qdisc point to eth0 2) Start a chain on ingress of eth0 that first matches ICMP then invokes the simple action to shout. 3) display stats and show that no packet has been seen by the action 4) Send one ping packet to google (expect to receive a response back) 5) grep the logs to see the logged message 6) display stats again and observe increment by 1 hadi@noma1:$ tc qdisc add dev eth0 ingress hadi@noma1:$tc filter add dev eth0 parent ffff: protocol ip prio 5 u32 match ip protocol 1 0xff flowid 1:1 action simple sdata "Incoming ICMP" hadi@noma1:$ sudo tc -s filter ls dev eth0 parent ffff: filter protocol ip pref 5 u32 filter protocol ip pref 5 u32 fh 800: ht divisor 1 filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 match 00010000/00ff0000 at 8 action order 1: Simple <Incoming ICMP> index 4 ref 1 bind 1 installed 29 sec used 29 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 hadi@noma1$ ping -c 1 www.google.ca PING www.google.ca (74.125.225.120) 56(84) bytes of data. 64 bytes from ord08s08-in-f24.1e100.net (74.125.225.120): icmp_req=1 ttl=53 time=31.3 ms --- www.google.ca ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 31.316/31.316/31.316/0.000 ms hadi@noma1$ dmesg | grep simple [135354.473951] simple: Incoming ICMP_1 hadi@noma1$ sudo tc/tc -s filter ls dev eth0 parent ffff: filter protocol ip pref 5 u32 filter protocol ip pref 5 u32 fh 800: ht divisor 1 filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1 match 00010000/00ff0000 at 8 action order 1: Simple <Incoming ICMP> index 4 ref 1 bind 1 installed 206 sec used 67 sec Action statistics: Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 SEE ALSO
tc(8) tc-actions(8) iproute2 12 Jan 2015 Simple action in tc(8)
All times are GMT -4. The time now is 02:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy