Programming :: Bash Script To Ping A Range Or Own IP-range?
Apr 11, 2011
I want to build a bash script, which can ping a range IP adresses which will be filled in by the admin. If there is no IP-adress filled in, then the script must ping the subnet where the system is logged on. So if my ip is 192.168.1.6, then the script must ping from 192.168.1.1 till 192.168.1.255 Or else, if there is given a beginning and ending ip it must ping that!
The first part of the bash script is to ping a given range (see below). But there is one problem, how can I tell the script to ping from $begin till $end, [..] is of course wrong! But what must be filled in there???
echo "Enter beginning IP-adres:"
echo "Enter ending IP-adres:"
ping -c 1 $begin [..] $end
The second part is to find my own ip and ping the whole range.. How to do that? I only can find my own IP, but I cant ping the whole range,, how to do that?
I want to plot a set of data in only one plot.The problem is that some points of the data should be better plotted in a linear scale (lets say 0 to 100,000) but there are other data points that, exceding the value 100,000, would be better plotted in a logarithmic scale, as they goes in the range 100,000 to 500,000,000. Let's say the data is:
X Y 0 100 10000 80 20000 75
Is there a way to plot all these points in the same plot in only one X-axis showing two different ranges in that axis: linear: 0-100,000 logarithmic: 100,000 - 1,000,000,000?The axis would be read, for example, as:
How can I get/filter history entries in a specific range?I have a large history file and frequently usehistory | grep somecommandNow, my memory is pretty bad and I also want to see what else I did around the time I entered the command.For now I do this:get match, say 4992 somecommand, then I do history | grep 49[0-9][0-9]this is usually good enough, but I would much rather do it more precisely, that is see commands from 4972 to 5012, that is 20 commands before and 20 after. I am wondering if there is an easier way? I suspect, a custom script is in order, but perhaps someone else has done something similar before.
As you can see on the output of the script, the two 'testing echoes' I do at the end don't print anything.That's the point, I do NEED this array further in my script.I'd understand my "param" var is local to the for, but is the other one too ? I tried to use "declare -a file" before the for, but i get same exact result !
I've just started programming at my university and I'm finding it a bit hard to get started. I've been given this for homework.Given 2 integers, a and b, print their sum. However, sums in the range 10..19 inclusive, are forbidden, so in that case just print 20The problem I'm having is that i don't know how to tell java to print 20 when the value is in that range.
I have a hard time figuring this out. I need to replace the date formats of arrival date(column 31-40) and departure date(column 42-51) and I need 2 outputs. I cannot even figure out how to start.code...
From a file I want to extract a range of lines by patterns. I've used variations on
Code: sed -n -e '/^BashNotes/,/^EndOf[A-Za-z]*$/ p' -e '/^EndOf[A-Za-z]*$/ q' Notes
So, I want to extract lines starting from one whose first word is specified, in this case "BashNotes", and ending at the first line consisting of the single word "EndOf...", which in this case would be "EndOfBashNotes".
Either I get no output at all, or it prints from the start of file to the first EndOf..., so the problem has to be with "^BashNotes", e.g. remove the "^" and it accesses an earlier occurrence of "BashNotes" that is in the middle of the first line of the file, and prints to the first occurrence of "EndOf...".
So why should a "^" in the "from" pattern be objectionable, when it is acceptable in the "to" pattern and the "quit" statement?
I'm looking for a c++ code that search for all files in computer between two input dates (example- 3.3.2011 and 11.4.2011)and copy all file in that range in new file .the user run the program and input date and path in dos system
Program in CSay I have a char array of 1024 bytes called buf1.But I only want to print the chars in index 0 up to index 30. I know I could do this with a for loop. But is there any other way? What about maybe storing from 31-1024 to another char array say buf2 with strcpy and somehow popping 31+ out of the buf1 char array?
In the MySQL database for one of my programming projects, I used a "YEAR(4)", because I wanted the column to contain four-digit year values. I discovered, though, that this type only allows values from 1901 to 2155, which is not workable as some year values are previous to the twentieth century. But I do not want a "DATE" type because the month and day are of no interest to me. What type should I convert to that would be the least radical change in data type, while giving more range?
So I need everything between each name, but I am not guaranteed that each time I match a name that I will have the same amount of lines, so I do a range pattern search line this to get all lines, no matter if there is 5 or 10 or 15. I simply do a loop that goes through the whole array until I hit the match, and this is my search pattern.
This works perfectly... until I hit the end and it doesn't get its final pattern match because it's at the end and there is no next entry with a (Address) line. So as a 'hack', I ended up inserting a final scalar at the end of the array that just says (Address) so it knows it's at the end. Ideally though, I'd like to do an "or" statement that says search for Address || return true if I hit the end of the array. How would I match on "End Of Array" essentially?
Having a bit of an issue with Python while trying to write a script to download every rar file on a webpage. The script successfully downloads any link that doesn't contain any spaces, etc. But when it hits a url like: [URL] (Classical Spelling).rar. It fails...I'm sure this is something simple, but I'm so new to python I'm not sure what to do!
Code: import urllib2 import os os.system("curl [URL] -i rar|cut -d '"' -f 2 > temp.out ") infile =open('temp.out', 'r') for url in infile: print url #url = "[URL]"
I'm having a bit of trouble with a regular expression I'm trying to write and I'm not sure if it's something Tcl specific or my lack of regexp understanding.
I get a number of strings passed to a proc in the format 3|x where x is a number, either 0 or within the range 5-12. My understanding is that that regexp will match the literal '3' followed by a '|', the escapes the special meaning of |, and then 0 or, because of |, a number within the range 5-12. However I'm getting the error 'couldn't compile regular expression pattern: invalid character range'.
My screen is always telling me "signal out of range. 75.0 KHz / 60 Hz when I have my graphic card driver installed. I have tried many ways to solve that problem and I have been tried many things that I read in many tutorials. I don't know how to solve that and I've been trying new things for nearly 2 weeks.I have tried the same thimgs in ubuntu 10.10, 9.10 and 9.04 but with no results.
I am running a VPN (Juniper Networks client) and an ifconfig shows me that its opening a tunnel and also adding routing instructions (I think). Anyway the problem is that when I'm connected to the VPN, I lose route to all my local machines and this is getting annoying when I want to use ssh.Does anyone know how to not route a certain range of IP's through the VPN?
I have been trying unsuccessfully to load Debian on my desktop. I have tried both live and otherwise. Both AMD64 and i386. It seems to be loading fine and then all of a sudden the monitor quits with a sign Input signal out of range. I have tried lots of other live disks and they have worked fine. My monitor is a Hanns G and my video card is NVIDIA GeForce8200. All other stuff very normal. 4 Gigs of RAM. What?
I recently installed Fedora 12 -- a brand new install, not an upgrade. The system was previously using Fedora 11 without any problems. Fedora 12 installed without any issues, and I haven't really done any customization to it. I am running KDE. The system is hooked up a KVM switch.
When I am on system #2 (a Windows system) and I switch back to system #1 (Fedora) after a few minutes of time, the Fedora screen will be blank and the monitor will present an "input signal out of range" error. I can SSH into the box and kill X to get the screen back. This has not happened on this system with any previous versions of Fedora that had been running on it (everything since Fedora 7).
I am trying to add a custom allow rule in the firewall for a range of IPs from 184.108.40.206 - 220.127.116.11, what exactly am I supposed to enter in the source box? I believe I have to add two separate rules for 102 and 103, and I put /24 at the end of both, is this correct to get the whole range of IPs?
I have been trying to get a DHCP PXE server up for a few days now, this is what I got so far..I am following this how-tohere are some outputs and what-nots, go to the last one to see the problem I am having.the host network
Code: :~> /sbin/ifconfig br0 Link encap:Ethernet HWaddr 00:19:DB:62:97:20