Find last occurence of a string using findstr on windows command line -
i have text file string occurs multiple lines. want line last occurrence of string. find occurrences using below command want last occurrence in single line command.
findstr /c:"apple ball cat" book.txt
can guide me if possible?
for command command line:
(for /f "delims=" %g in ('findstr /c:"apple ball cat" book.txt') @set "lastoccur=%g")&set lastoccur
from batch script:
@echo off set "lastoccur=" /f "delims=" %%g in ('findstr /c:"apple ball cat" book.txt') set "lastoccur=%%g" set lastoccur echo "%lastoccur%"
in echo
command (possible, supposed) cmd
-poisonous characters escaped using double quotes.
Comments
Post a Comment