I have some log files. And I have a list of user ids. My log files are in a particular format
log-yyyy-mm-dd e.g. log-2014-09-30
I am trying to search each userId in the log file. This is what I am doing -
for userid in 234, 283, 893, 982, 323; do cat log-2014-09-30 | grep -a "user deleted "$userid | tail -1; done
Ideally it should search each user id in the file and print the last match. I will then search in
log-2014-09-29 for the remaining user ids and so on.
But it is only printing the match for the last user id.
INFO - 2014-09-30 22:49:00 - user deleted 323
What am I doing wrong? please help me out.