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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -