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

ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -

c++ - nodejs socket.io closes connection before upgrading to websocket -

python - PyQt: Label not showing correct number of length -