LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2004, 08:30 AM   #1
delos
Member
 
Registered: Jun 2004
Posts: 38

Rep: Reputation: 15
pinging


i need to ping a lot of ip-s. have to find dead ones and check for speed. now i manually use
ping -c 1 ip
for every ip and this takes a long time. i would like to be able to list the ip-s in a file and somehow do it automatically. is there a way?
using suse9.1
 
Old 07-02-2004, 08:34 AM   #2
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
Create a file with all your IPs - one per line.

You can then enter the following at the command line, or put it in a script and run it:

for x in `cat [IP_FILENAME]`
do
ping -c 1 $x >> iplist
done

Where [IP_FILENAME] is the name of file with all your IP addresses. This will write the output for each ping to a file called 'iplist' this will be created in whatever directory you are in.
 
Old 07-02-2004, 08:54 AM   #3
delos
Member
 
Registered: Jun 2004
Posts: 38

Original Poster
Rep: Reputation: 15
this is what i get....
Quote:
delos@linux:~> for x in /home/delos/down/ipz do ping -c 1 $x >> iplist done
bash: syntax error near unexpected token `>>'
whats wrong?


Last edited by delos; 07-02-2004 at 09:02 AM.
 
Old 07-02-2004, 09:00 AM   #4
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
You need to type:

for x in `cat /home/delos/down/ipz` [CR]
do [CR]
ping -c 1 $x >> iplist [CR]
done [CR]

When [CR] is a carriage return (press the return key)
 
Old 07-02-2004, 09:07 AM   #5
delos
Member
 
Registered: Jun 2004
Posts: 38

Original Poster
Rep: Reputation: 15
i managed to figure this out but i still have some problems, just different ones.

Quote:
delos@linux:~/down> for x in 'cat /home/delos/down/ipz'
> do
> ping -c 1 $x >> iplist
> done
ping: unknown host cat
delos@linux:~/down> for x in 'cat ipz'
> do
> ping -c 1 $x >> iplist
> done
ping: unknown host cat
delos@linux:~/down>
iplist is created but it is empty. some of the ips in my list (home/delos/down/ipz) work for sure so that is not the problem.


edit: i seem to have been beaten with a stupid-stick today. for some reason i used '' instead of ``.


thank you for your help

Last edited by delos; 07-02-2004 at 09:13 AM.
 
Old 07-02-2004, 09:11 AM   #6
ph4nt0m
LQ Newbie
 
Registered: Nov 2003
Location: UK
Posts: 15

Rep: Reputation: 0
You're using the wrong punctuation marks - you need backticks, not single quotes. Copy and paste this character: `

That is the tick you need to use.
 
Old 07-02-2004, 09:14 AM   #7
delos
Member
 
Registered: Jun 2004
Posts: 38

Original Poster
Rep: Reputation: 15
thank you very much. works
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pinging in one direction but not the other dehuszar Linux - Networking 5 01-20-2005 01:05 PM
Pinging?? Sherpa Linux - General 3 05-13-2004 07:23 AM
Network not pinging any more. duffboygrim Linux - Networking 2 03-30-2004 05:05 PM
Problem with pinging :( Normanu Linux - Networking 1 11-21-2003 09:33 AM
Oh, that constant pinging... thosm Linux - Networking 4 07-31-2003 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration