Solved batch file to search and copy rquired data

March 24, 2014 at 01:28:31
Specs: Windows 7
I need desperate help in creating a batch file that reads from a log/txt file, searches for a specific word ex Computer name and then writes to another text file the words/digits below before.

I don't think I managed to make myself clear..the log file would contain say " asgf agahi a hi af as L124334 Computer name" I require L124334

I am new to batch programming and would appreciate any help

See More: batch file to search and copy rquired data

Report •

March 24, 2014 at 21:22:22
✔ Best Answer
This might work if there's no commas or quotes in the file-stream. It's funky. I'm not proud of it. You're better off with higher-capacity languages.
::======= begin script
@echo off & setlocal enabledelayedexpansion
set k=computer name
for /f "tokens=*" %%a in ('find "%k%"^<"mass.txt"') do (
set z=%%a
set z="!z:%k%=",!
call :1 !z!
goto :eof

set w=%1
call :2 %~1
goto :eof

set w=%~1
if "%1" neq "" GOTO :2
::=========== end script

message edited by nbrane

Report •

March 28, 2014 at 06:24:30
thanks mate..managed to work up a solution :)

Report •
Related Solutions

Ask Question