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

Josiah Ritchie jritchie at bible.edu
Fri Jul 30 11:56:14 CDT 2004


I managed to do what I wanted with a one-liner (if you can call it that
being so long. :-)

cat /var/lib/dhcp/dhcpd.leases|tr -d "\n"|tr "}" "\n"|tr -d "\""|tr -d
";"|grep -v '^#'|gawk '{print $2 ": " $25 " = " $21}'

Now I seem to remember a way to make sure that none of the lines were
duplicates using grep, but the man pages isn't helping me out. Anyone
have that off the top of their head?

Thanks,
JSR/

On Fri, 2004-07-30 at 09:42, Frank Bax wrote:
> At 05:08 PM 7/29/04, Josiah Ritchie wrote:
> 
> >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 }?
> 
> 
> I would use sed/tr to remove all newlines, then insert a new line in "} lease".
> 
> 
> _______________________________________________
> ChristianSource FSLUG mailing list
> Christiansource at ofb.biz
> http://cs.uninetsolutions.com





More information about the Christiansource mailing list