troubleshooting Question

Shell Script - Syntax question (for)

Avatar of joaotelles
joaotellesFlag for United States of America asked on
ProgrammingShell Scripting
8 Comments1 Solution451 ViewsLast Modified:

Im writing a shell script but I stuck in a problem:

I have files like this in a directory:

TrafficErrorEvents20130813.0040  TrafficErrorEvents20130813.0099  

I have more than one file for each day - for example of the day 13th I have two...

So, what I need is that every, lets say Friday, I need to do a grep on the files of the last 7 days and get some information..

I was thinking on use a ´for´ statment to increase variable here:

date +"%Y%m%d" --date="1 day ago"

And then a grep like this:

cat TrafficErrorEvents$VARIABLE.* | grep XXXXX

Is this the easy/fatest way to do this?

How can this for be? - the syntax?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros