Используйте findstr для вывода символов 1-13

410
José Araújo

У меня есть код: findstr /B ^121.*.CATDrawing catdrawing.txt

Как показать с первого по тринадцатый символ?

1220112000001A.CATDrawing -> 1220112000001 
0

1 ответ на вопрос

1
Rik

Uuuh... exactly how is that regular expressions ^121.*.CATDrawing going to match that line with 1220112000001A.CATDrawing? There is not even 121 in that string ;)

But... going with the assumption you made a typo you could do the following:
(I also made the assumption you wanted this in a batchfile)

@echo off for /f %%i in ('findstr /B ^121.*.CATDrawing catdrawing.txt') do call :processline %%i goto :eof :processline set line=%*% echo %line:~0,13% 
Не знал об особенностях обработки подстроки в пакетном сценарии Windows (переменная: ~ N, M). Ницца! glfabro 9 лет назад 0