[NTLUG:Discuss] OT : Linux log file search
Leroy Tennison
leroy_tennison at prodigy.net
Mon Jul 10 22:02:41 CDT 2006
Tom Tumelty wrote:
> I am looking for a way to search approximately 1300 .gz compressed log files
> for specific strings. probably need to do this from a windows 2000 machine.
> Does anyone have any ideas ?
>
> Thanks in advance,
> Tom
> _______________________________________________
> http://ntlug.pmichaud.com/mailman/listinfo/discuss
>
>
If you are going to do it from a Windows machine your choices are
limited. My recommendation:
1. Get these files in one location, create an empty subdirectory
below that location, let's call it 'check'
2. Get yourself a DOS program which can either decompress a gz file
(gunzip) or can search a compressed file for a string (I don't
know of one)
3. Learn the Windows 2000 variant of the DOS 'for' command
4. Learn the Windows 2000 variants of the 'findstr' and 'find' commands
5. Do something like: for %x in (*.gz) do call searchit.bat %x
searchit.bat contains
move %1 check
cd check
..\gunzip %1
for %y in (*) do find "<search string>" %y & if not errorlevel 1 <do
something useful but not in this directory>
echo y | del *.*
cd ..
There are ways to accomplish things in the Windows world which bear a
resemblance to what you can accomplish in the *NIX world but it takes a
lot more effort and creativity.
Other things to consider:
install CYGWIN and use native *NIX world utilities under Windows/DOS
There is a UNIX Services with Windows and it may have some enhanced
scripting languages worth using.
Get a DOS port of AWK and learn how to use this text processing program,
I rely on it at work.
Get a DOS port of Perl (ActivePerl) and learn to use this scripting
language.
Of course, this begs a question:
Why not get these files on a Linux PC where you have capable utilities
to work with natively instead of having to limp along with what Windows
provides or find DOS ports of the capable *NIX world utilities to get
something useful done?
Maybe you, like me, don't have a lot of choice because your employer
isn't very progressive technologically. If that's the case then I
understand and empathize.
More information about the Discuss
mailing list