Re: Finding Characters only in string of lines
- From: Jerold Schulman <Jerry@xxxxxxxxxx>
- Date: Thu, 25 Aug 2005 12:32:53 -0400
On Wed, 24 Aug 2005 08:21:10 -0700, "John" <John@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>I current have a batch script that executes a shell command which stdout to
>the Windows shell a string of characters.
>
>I capture the string of characters into a variable then write it into a text
>file.
>
>I would like to only capturer only a few characters that?s in the variable.
>
>Example would be anything that starts with # and ends in ?
>
>In a nutshell I want to capture a number that is in the stdout of the
>command.
>
>This number always increments as the script runs.
>
># '243'
@echo off
setlocal ENABLEDELAYEDEXPANSION
For /F "Tokens=*" %%a in ('YourCommand^|findstr /B /L /C:"# '"^|findstr /E /L /C:"'"') do (
set work=%%a
set /a number=!work:~3,3!
@echo !number!
)
endlocal
.
- Follow-Ups:
- References:
- Finding Characters only in string of lines
- From: John
- Finding Characters only in string of lines
- Prev by Date: script as scheduled task that would delete files using Shift+Delet
- Next by Date: HTA's and VBScript, write Output to an Excel file?
- Previous by thread: Finding Characters only in string of lines
- Next by thread: Re: Finding Characters only in string of lines
- Index(es):
Relevant Pages
|