DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Reads Log Files

12.12.2007
| 2215 views |
  • submit to reddit
        // Map directory structure and then read logs extract results.

!#/usr/bin/bash

for line in `ls /netapp/XXXXXX0/XXXXXX_logs`
	do 
	for line2 in `ls  /netapp/XXXXXX0/XXXXXX_logs/$line`
			do  echo /netapp/XXXXXX0/XXXXXX_logs/$line/$line2 
	done	
done | grep 2007-11-29 > results.dat

!#/usr/bin/bash
for res in `cat results.dat`
 do
 echo -n $res 
 echo -n " "
 grep -c ",i," $res/*
done