The Moose and Squirrel Files

August 27, 2008

Writing Filters in VBScript

Filed under: Code — Tags: , — networknerd @ 3:18 pm

The original philosophy of unix was to create a set of tools that do one job well and that could be chained together in a pipeline.  Each program was a filter, and it’s a powerful concept once you get your head around it.  Unfortunately that concept didn’t really make it into windows.

All is not lost, however, because we can easily create our own custom filters in vbscript on almost any windows box. No C compiler required; no downloads of cygwin or the MKS Toolkit. When using cscript we can read from STDIN, perform some manipulations and write to STDOUT.

The example below uses this technique to convert logfiles exported from the checkpoint log viewer into CSV format.  By using the filter technique the data can be analysed and converted in one hit by piping the transformed data directly into Microsoft’s logparser utility. (more…)

Create a free website or blog at WordPress.com.