I have just written a bash
script and it works as I wanted. That is the script :
#!/usr/bin/env bash
DY=`date +%Y%m%d`
gunzip -c /var/log/cisco/cisco.log-$DY.gz > file.log
sleep 3
cat file.log | grep "Virtual device ath0 asks to queue packet" > file2.log
awk '{print $4}' file2.log > IP.log
sort IP.log | uniq > devices.log
wc -l devices.log
rm file.log file2.log IP.log devices.log
However, because I am new in bash
I would ask if there is a better way to do that kind of script (still in bash
environment). Any explanations will be very useful to improve my learning.
For other improvement I have no idea! Everything that can come from your experience, knowledge is well accepted.
How you would write that script?
– Federi Nov 04 '15 at 15:06