[CS-FSLUG] Shell Scripting A Solution to Network Monitoring

Josiah Ritchie jritchie at bible.edu
Thu Jul 29 16:08:44 CDT 2004


I have a dhcpd.leases with a bunch of entries like this:
lease 10.0.11.147 {
  starts 4 2004/07/29 20:42:19;
  ends 4 2004/07/29 20:52:19;
  binding state active;
  next binding state free;
  hardware ethernet 00:90:4b:b0:04:f4;
  uid "\001\000\220K\260\004\364";
  client-hostname "DWK";
}

and I want to write a script to take each entry and extract the data I
want into the format:
hostname: IP = MAC
so that I can easily bop around seeing what's up on this wireless
network without parsing through a mess of stuff I don't want. I could
then easily manipulate it with grep for some more fun.

I'm not looking for a solution to the above problem. (I want to stuggle
through that on my own... until I ask for more help. :-) What I would
like to know is if anyone knows of a quick and easy shell script way to
take all those lines and concatenate them together so I have each entry
on its own line starting with "lease" and ending with }?

Otherwise I have to start messing with counters and stuff that would
quickly make the script big. Also, the entries don't all necessarily
have the same number of lines in them. Occasionally the client-hostname
is left out.

Thanks,
JSR/





More information about the Christiansource mailing list