for f in `jot - 0 50 5` ; do ping -c 1 -m 50 10.0.2.$f ; done

sequence of numbers in a for loop

Say you need to ping every 5th IP address on your network .. this will give you a way of doing that. jot can also do counting ... like jot 4 1 2 3 4 download from http://oreilly.com/catalog/upt2/examples/#jot or fins athena-jot in rpm format
Sample Output
--- 10.0.2.0 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max/stddev = 336.439/336.439/336.439/0.000 ms
PING 10.0.2.5 (10.0.2.5): 56 data bytes
?^C
--- 10.0.2.5 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.10 (10.0.2.10): 56 data bytes
^C
--- 10.0.2.10 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.15 (10.0.2.15): 56 data bytes
^C
--- 10.0.2.15 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.20 (10.0.2.20): 56 data bytes
^C
--- 10.0.2.20 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.25 (10.0.2.25): 56 data bytes
^C
--- 10.0.2.25 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.30 (10.0.2.30): 56 data bytes
^C
--- 10.0.2.30 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.35 (10.0.2.35): 56 data bytes
^C
--- 10.0.2.35 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.40 (10.0.2.40): 56 data bytes
^C
--- 10.0.2.40 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.45 (10.0.2.45): 56 data bytes
^C
--- 10.0.2.45 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss
PING 10.0.2.50 (10.0.2.50): 56 data bytes
^C
--- 10.0.2.50 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss

-5
2009-03-23 23:51:18

These Might Interest You

What Others Think

You mean just like seq? seq 4 seq 2 6 seq 2 5 13
mem · 477 weeks and 5 days ago
and pure SHELL, BASH v3: for (( num=5; num<51; num+=5 )); do echo $num; done or BASH v4: echo {5..50..5} Why limit yourself to only numbers :P? echo {A..Z} and mix'n match: echo {A..E}{1..3}
asmoore82 · 477 weeks and 5 days ago
Yeah, Came here to ask why would you install (or write) jot when seq and the built-ins both work.... and are pretty standard...
ozymandias · 477 weeks and 5 days ago
This was intended for machines that don't have gnu coreutils installed by default like hpux and solaris You would need to download and install something anyway in that case Have only used seq for numbers, but jot also does letters and words
chinkshady · 477 weeks and 4 days ago
FreeBSD also doesn't have seq but jot. thanks @chinkshady
lme · 477 weeks and 3 days ago
And of course FreeBSD doesn''t have that messy bash in the base system. ;-)
lme · 477 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: