[vox-tech] bash scripting question

Cylar Z cylarz at yahoo.com
Wed Apr 25 20:28:40 PDT 2007


Hey programming gurus...
 
I want to write a script which takes a block of text
and extracts any numbers which match a 123.456.789.012
pattern. I am not looking for any numbers in
particular (so I don't think the grep command will be
of much help) but rather, any set of numbers that
looks like an IP address. 

Basically the script is to look through some log files
and find all of the IP numbers listed there. Having
accomplished this, the script is to compile a list of
the numbers it finds by redirecting the output to a
text file. I'm planning to set this up as a
supplemental automatic log-scanning tool that will run
nightly as a cron job.

Could sed or awk be of use here? Not intimately
familiar with either, but I have heard they are
powerful text-processing tools. I can research them on
my own if you guys think I should go that route. I'm
sure this is a simple task but I'm too green to know
where to start.

Your thoughts, please.

Thanks,
Matt

> 


More information about the vox-tech mailing list