Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Honestly I'm new to programming, and I'm needing some help with something I'm working on. And honestly the files I'm grabbing from isn't helping me.
The first problem is information I'm trying to extract from the log files needs to be extracted from the bottom up and stop looking at say the word stop.
Secondly some of the log files have more than one instance of the information and it needs to be processed seperately, and then the file needs to be saved with the day before's date.
so the info goes kinda like this
245.04,756.23,test
345.74.123.87,test2
123.99,123.56,test3
I'm looking to extract the information from the second group of numbers, and the problem is sometimes the test2 line might not be there. So I want to get a value of 0 put if it's not there.
Any help would be greatly appreciated.

You need to be clear about the rules for extraction.
=====================================
Helping others achieve escape felicityM2

Sorry that I forgot a couple of important parts
This is off a text file that I can't really alter.The rules of extraction would be basically be.
245.04,756.23,test
345.74.123.87,test2
123.99,123.56,test4Look for test, test2, test3, test4 extract data. If data for anything looked for isn't present enter 0 so that extracted would come out like
756.23
123.87
0
123.56Thank you

@echo off > newfile & setLocal enableDELAYedexpansion
set N=
for /f "tokens=* delims= " %%a in (datafile) do (
set /a N+=1
if !N! equ 1 (
> mydata echo %%a1
) else (
>> mydata echo %%a
)
)set N=
set X=for /f "tokens=3 delims=," %%a in (mydata) do (
set str=%%a
set X=!str:test=!
)for /L %%i in (1 1 !X!) do (
set /a N+=1
set data=0
for /f "tokens=2-3 delims=," %%d in (mydata) do (
if %%e equ test!N! (
set data=%%d
)
)
>> newfile echo !data!
)
=====================================
Helping others achieve escape felicityM2

![]() |
Help with VB macros
|
Backup Only Modified or N...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |