find the number in log file

Microsoft Windows xp professional w/serv...
July 29, 2010 at 00:04:50
Specs: Windows XP
Hi Guru,
I am new to batch scripting and new to this site. I want to get some help from you guys and tried to write with your answers to other guys but no luck. Could you please help me to find the number 700.00 from below line from log file.
I will be running the script every 30 minutes as this file has been updated every 30 minutes to pick the number from this line as below. Line text will not change.

Error [1001] WDC Plot: Outgoing Data Last half hour, Avg Val 700.00

Thanks in advance
Mat


See More: find the number in log file

Report •


#1
July 29, 2010 at 19:07:26
Can anyone please help !!!!!

Report •

#2
July 29, 2010 at 19:26:58
I'm still sort of learning the FOR command, but if you're looking to ECHO the number, this should do the trick:
@ECHO OFF

FOR /f "tokens=12 delims= " %%a IN (FileName.txt) DO @ECHO %%a
PAUSE


Report •

#3
July 29, 2010 at 19:48:31
findstr  "700.00$" file

GNU win32 packages | Gawk


Report •

Related Solutions

#4
July 29, 2010 at 21:25:36
Thanks guys for replying. I am trying as suggested but i am getting the screen with 'press any key to continue. . .
My script is as below
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=12 delims= " %%a IN ("C:\SystemStatus.log") DO @ECHO %%a
pause

Report •

#5
July 29, 2010 at 21:27:31
Hi
findstr "700.00$" file will not work as the digits like 700 will keep changing only the constant is the line before the number. I think we have to match the line and then get the last number of the line. My one cent thought.

Report •

#6
July 30, 2010 at 01:27:27
hiiiii
Hi
findstr "700.00$" file will not work as the digits like 700 will keep changing only the constant is the line before the number. I think we have to match the line and then get the last number of the line. My one cent thought.

________________
"Want to get-on Google's first page and loads of traffic to your website?
Hire a SEO Specialist from Ocean Groups [url=http://www.oceangroups.org]seo specialist [/url]
"


Report •

#7
July 30, 2010 at 08:09:44
The following should get you just the updated number, or
do you want the whole line?

Anyway, change 'set logfile=logfile' to equal your actual
log file.

@echo off

set logfile=logfile

for /f "usebackq tokens=1* delims=," %%a in (`findstr /i /c:"Error [1001] WDC Plot: Outgoing Data Last half hour, Avg Val" "%logfile%"`) do (
  for %%c in (%%b) do set AvgVal=%%c
)
echo.%AvgVal%



Report •


Ask Question