Batch file Help Needed Immediately

April 11, 2010 at 09:27:12
Specs: Windows Vista
This is a output of the file ex test1.txt

type test1.txt
1 HP.ULTRIUM4-SCSI.002 hcart2 DOWN-TLD Yes -
2 HP.ULTRIUM4-SCSI.003 hcart2 TLD Yes -
3 HP.ULTRIUM4-SCSI.004 hcart2 DOWN-TLD Yes -
4 HP.ULTRIUM4-SCSI.005 hcart2 TLD Yes ACN049FFMB

From the output I need the line that is having only DOWN-TLD in a new file example testout.txt I need batch file for this . Kindly help me immediately.

Already I am trying using for loop but it's not woking

SET TMPFILE=C:\TEMP\phd.20655.txt
SET TMPFILE_OUT1=C:\TEMP\phd_OUT1.%random%.txt
for /F "delims=" %%d in (%TMPFILE%) do (
%%d
for /f "tokens=4" %%C in (%TMPFILE%) do (
SET s1=%%C
echo %s1%
if /I %s1% neq TLD (
%%d
%%d >> %TMPFILE_OUT%
)
)
)


See More: Batch file Help Needed Immediately

Report •

#1
April 11, 2010 at 12:26:35
type C:\TEMP\phd.20655.txt | find "DOWN-TLD" > C:\TEMP\phd_OUT1.%random%.txt


Report •

#2
April 11, 2010 at 21:10:09
Sometimes 4th column may go to some other state like AVR.
So I need output like other than TLD in the 4th column,goes to my output file

Report •

#3
April 12, 2010 at 02:06:21
@echo off & setlocal
set TMPFILE=C:\TEMP\phd.20655.txt
set TMPFILE_OUT=C:\TEMP\phd_OUT1.%random%.txt

type nul > %TMPFILE_OUT%
for /F "delims=" %%z in (%TMPFILE%) do (
  echo.%%z
  for /F "tokens=4" %%j in ("%%z") do (
    if /I not "%%j"=="TLD" (
      echo.    %%z
      echo.%%z>> %TMPFILE_OUT%
    )
  )
)
:: End_Of_Batch


Report •

Related Solutions

#4
April 12, 2010 at 03:37:47
The following one line command does the same as the batch in the previous post. Anyway your request is confused (almost for me)

type C:\TEMP\phd.20655.txt | find /V /I " TLD " > C:\TEMP\phd_OUT1.%random%.txt


Report •

#5
April 12, 2010 at 19:50:42
Thanks IVO for your immediate help it's working fine and I am satisfied.

Thanks once again!!!!


Report •

#6
April 14, 2010 at 05:59:23
Sometimes 4th column may go to some other state like AVR.
So I need output like other than TLD in the 4th column,goes
to my output file

___________________________________________________
_
[url=http://www.buyonlinesteroids.com]deca[/url]
[url=http://www.eaststroudsburghotels.com]East Stroudsburg
Hotels[/url]


Report •

Ask Question