Re: findstr, for, or other command to do this?

From: djc (noone_at_nowhere.com)
Date: 04/28/04


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."



Relevant Pages

  • Re: cmd problem
    ... Panel>add/remove programs/add utilities from my XP disk. ... Try this command, but change the X: ... Can't open input file: filename. ...
    (microsoft.public.windowsxp.basics)
  • Re: Nero AAC encoder front-end
    ... I think this is actually an issue with Nero and Windows ME, ... I can't seem to get it to work from the command line either, ... You could try some older Nero encoder and decoder files if the ... I even put the executable in the same folder as the input file 003.wav ...
    (alt.radio.digital)
  • Re: Nero AAC encoder front-end
    ... The command prompt window simply opened and then immediately closed ... I think this is actually an issue with Nero and Windows ME, ... You could try some older Nero encoder and decoder files if the latest ones aren't working with ME. ... I even put the executable in the same folder as the input file 003.wav and ran a batch file containing the following commands. ...
    (alt.radio.digital)
  • Re: opening existing files with OPEN()
    ... was getting the program to read this format correctly. ... Command Prompt, I see both the executable AND the input file when I do ... no matching symbolic information found. ...
    (comp.lang.fortran)