Re: Finding Characters only in string of lines
- From: "Juan" <JDOE@xxxxxxxxxxxxx>
- Date: Sat, 27 Aug 2005 15:53:08 -0400
Thanks,
John
"Jerold Schulman" <Jerry@xxxxxxxxxx> wrote in message
news:4lsrg15i36pbbpkvqeu5gr9psnpun7og9m@xxxxxxxxxx
> 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
.
- References:
- Finding Characters only in string of lines
- From: John
- Re: Finding Characters only in string of lines
- From: Jerold Schulman
- Finding Characters only in string of lines
- Prev by Date: script to listen
- Next by Date: Re: Script Error
- Previous by thread: Re: Finding Characters only in string of lines
- Next by thread: VBscript to check remote SQL server
- Index(es):
Relevant Pages
|