Re: findstr, for, or other command to do this?
From: djc (noone_at_nowhere.com)
Date: 04/28/04
- Next message: Matthias Tacke: "Re: findstr, for, or other command to do this?"
- Previous message: djc: "Re: findstr, for, or other command to do this?"
- In reply to: wadester: "Re: findstr, for, or other command to do this?"
- Next in thread: Matthias Tacke: "Re: findstr, for, or other command to do this?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Apr 2004 10:25:18 -0400
interesting. Thanks for the reply!
"wadester" <null@devnull.net> wrote in message
news:MPG.1af87cc93f9b6b4d989690@msnews.microsoft.com...
> In article <uoLcquILEHA.1312@TK2MSFTNGP12.phx.gbl>, noone@nowhere.com
> wrote...
> > Situation: I have a log file with many fields and lines. Each line has
say
> > a computername field. The same computername will be listed several times
> > thoughout the file. What if I wanted a list of computer names from the
file?
> > meaning 1 instance of each name returned from a command?
> >
> > example: A log file has 2 fields. ComputerName and DLLVersion. I want to
> > construct a command or batch file that will return a unique list of
computer
> > names that do not have a DLLVersion equal to 4.1.002. Just using the
find
> > command gets me close but its not a unique list. The same computer names
> > will be listed multiple times.
> >
> > any input is appreciated. Thanks.
>
> Here's a starting place, at least:
>
> Input file in.txt:
> computer1 1.0
> computer2 2.0
> computer1 1.0
> computer2 2.0
> computer1 3.0
> computer2 3.0
>
> Find all unique computer names not at v3.0:
> ==========================================
> @echo off
> setlocal enabledelayedexpansion
>
> del tmp.$$$ >nul 2>&1
> for /f "tokens=1" %%I in ('findstr /v "3.0" in.txt ^| sort') do (
> echo %%I >> tmp.$$$
> )
>
> REM Parse thru the sorted temp file and compare each
> REM line to the previous one
> set oldline=.
> for /f %%l in (tmp.$$$) do (
> set line=%%l
> if !line! NEQ !oldline! echo !line!
> set oldline=!line!
> )
> ==========================================
>
> ws
>
>
> --
> I saw this in a movie about a bus that had to SPEED around a city,
> keeping its SPEED over fifty, and if its SPEED dropped, it would
> explode. I think it was called, "The Bus That Couldn't Slow Down."
- Next message: Matthias Tacke: "Re: findstr, for, or other command to do this?"
- Previous message: djc: "Re: findstr, for, or other command to do this?"
- In reply to: wadester: "Re: findstr, for, or other command to do this?"
- Next in thread: Matthias Tacke: "Re: findstr, for, or other command to do this?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|