subfreq.bat
Generated on Tue Dec 05 17:44:02 Eastern Standard Time 2006 from subfreq.bat
@echo off
title SUBFREQ - Count subjectlines from SUBDUMP files, create Web page and Atom file
if "%1" == "*html" goto convert
if not "%1" == "" goto docount
goto begin
Author : Bob Jonkman bjonkman@sobac.com
Date : 3 October 2006
Parameters : %1 Filename to process
Note : If this file is called without a parameter then it finds
filenames and calls itself with the filename as the parameter
If "%1" == "*html" then force conversion to HTML even if no files exist.
:begin
set source=\\vs-itddata\ITDDATA\ITD\ITD\Messaging\SUBJECTPURGEdata
echo Check for files...
if not exist %source%\*.rtf goto nothingtodo
echo Move files to local drive...
move %source%\*.rtf .\
rem Call this batch file with the filename
for %%i in (*.rtf) do call %0 %%i
echo.
:convert
echo Convert files to HTML...
gawk -f library.awk -f csv2html.awk -v TITLE="GW Top 10 Subject Lines" *-top10.csv > subfreq.html
echo Copy HTML to Web server...
copy subfreq.html \\cotgw506\sys\apache2\htdocs\stats\
echo All files are processed, we're done.
goto end
:docount
echo.
echo Convert %1 from RTF to TXT
gawk -f rtf2txt.awk %1 > %1.tmp
echo Add filename and date to headers...
echo %date% %1 > header.tmp
copy header.tmp + %1.tmp %1.txt
echo Count Subject Lines in %1
gawk -f library.awk -f parse-freq.awk %1.txt > %1.csv
echo Get the top 10 Subject Lines in %1.csv
gawk -f head.awk -v LINES=11 %1.csv > %1-top10.csv
echo Delete temporary files
del %1
del %1.txt
del %1.csv
del *.tmp
goto end
:nothingtodo
echo.
echo No files found, nothing to do!
goto end
:end
rem EOF: SUBFREQ.BAT
1 files processed.