I'm writing log-parsing automation script. Log directory structure is /var/log/yyyy/mm/dd/mainlog.ec Variables for this path are not constant, for sure they are like a=date +%d b= $[$a-7] This script will run in cron once per week and calculate some data from logs(for past 7 days), generate a report and send it on my e-mail. So i need to use a range of dates in path to logs i faced a some troubles creating some parsing-log script.
#!/bin/bash
a=`date +%d`
b=$[$a-7]
for i in pc1 pc2 pc3; do echo "$i `cat /var/log/2015/02/{$a..$b}/mainlog-1.ec | grep $i | wc -l`"; done
but i recieve:
cat: /var/log/2015/02/{10..18}/mainlog-1.ec: No such file or directory
pc1
cat: /var/log/2015/02/{10..18}/mainlog-1.ec: No such file or directory
pc2
cat: /var/log/2015/02/{10..18}/mainlog-1.ec: No such file or directory
pc3
How can i get {a..b} regexp in path working with my variables?