lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tuesday 01 February 2011 19:26:20 marbux wrote:
> On Tue, Feb 1, 2011 at 3:54 PM, Steve Litt <slitt@troubleshooters.com> 
wrote:
> >> My personal favorite... filters:
> >> http://lua-users.org/wiki/FiltersSourcesAndSinks
> >
> > Devils advocate:
> >
> > Why use filters in Lua coroutines when you could do:
> >
> > grep -v .jpg$  access_log | grep -v .gif$ | grep -v .class$ | \
> > calculate.lua | add_hdrs_and_footers.lua | \
> > sort | report.lua > traffic_report.txt
> 
> That solution is a non-starter if you are writing code that must be
> portable across various platforms, some of which do not have native
> support for grep. E.g., the various flavors of Windows.

It's been a long time but I seem to remember DOS (and therefore presumably 
Windows) having piping and redirection, and years ago Borland Turbo C came 
with a version of grep, and there now exists a grep for windows 
(http://gnuwin32.sourceforge.net/packages/grep.htm), so it is pretty much 
portable, and given that it's a one liner, if you have to change a few things 
that's five minutes.

As far as Mac, my understanding is that OS/x is BSD underneath, and if so then 
it would be portable to Mac.

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt