Never been to DZone Snippets before?

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

About this user

Aniline

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

Reads log files

// 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

Sed substitution

// Sed used to replace a string

#!/bin/bash

for line in `ls`
do
        sed -e 's/Spring/Regular Season/g' line > tmp
        mv tmp line
        echo -n $line
        grep Regular $line
done

Email in Bash

//Bash email
#!/bin/bash

function email
{
echo "this is a test" | mail -s "test" "$1"
}

if [ "$1" = "" ]; then
echo "nothing in param"
else
echo "sending mail"

#emailing attachment
#uuencode statsNbaAllStarSim statssim | mail -s "test attachement" atayebali@foxsports.com
#uuencode <filename that will be send> <name for attached file that is sent> |

#passing the param to function
email $1
fi

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS