Is it possible using findstr or another tool to get unknown text from a known position?
the text i need is always the 11th charactor in a file for 5 charactors.
ie aaaaaaaaaabbbbb
i need to get and use what bbbbb is.
unfortunately this text changes so i'm not able to search on what it is.
Thanks
grab specific text from a location in a file.
Moderator: DosItHelp
Re: grab specific text from a location in a file.
If you are parsing a text file with a for Loop you can set the loop variable to another variable and then parse the string by position. Is this unknown text on a specific line in the file? Or is the file just one line long?
http://www.dostips.com/DtTipsStringMani ... .MidString
http://www.dostips.com/DtTipsStringMani ... .MidString
Re: grab specific text from a location in a file.
Hi, thanks for the reply. The file in question has many many lines but i'm only interested in the first row. the data is unknown but the location is fixed, it is always charactors 11-15
Cheers
Chris
Cheers
Chris
Re: grab specific text from a location in a file.
'
Code: Select all
@echo off
set "var=aaaaaaaaaabbbbb"
set "var=%var:~10%" %= pos 10 =%
set "var"
pause
set /?
pause
Code: Select all
var=bbbbb
Re: grab specific text from a location in a file.
Thanks for this, presumably i would use findstr to grab the first line - how do i get what it grabs to become a variable as ordinarily it echo's the result?
Thanks
Thanks
Re: grab specific text from a location in a file.
'
Code: Select all
>"ou.TMP" echo.testing 1 2 3
<"ou.TMP" set /p "var="
echo.%var%
Code: Select all
testing 1 2 3