Re: Finding Characters only in string of lines

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: Help needed for perl rookie
    ... (characters with special meaning inside regular expressions). ... string matched by the contents of the parens. ... we see that \d+ matches any string of one or more digits. ... strings of digits followed by space characters, and capture the ...
    (comp.lang.perl.misc)
  • Re: How to capture PrettyPrint output to string?
    ... > I'd like to capture the output of pp (PrettyPrint) as a string, ... > opposed to putting it on stdout. ...
    (comp.lang.ruby)
  • Re: check a string against a array
    ... characters and a string which is converted into hexadecimal. ... need to capture them as well. ... You are using joinwith a space character but there are no spaces in that string. ...
    (perl.beginners)
  • Finding Characters only in string of lines
    ... I current have a batch script that executes a shell command which stdout to ... I capture the string of characters into a variable then write it into a text ...
    (microsoft.public.windows.server.scripting)
  • Re: Finding Characters only in string of lines
    ... >>I current have a batch script that executes a shell command which stdout ... >>the Windows shell a string of characters. ...
    (microsoft.public.windows.server.scripting)