Phil, I was pulling my hair out for a week and couldn't get this working. Thanks SO much! Both versions you presented work, the second one much faster.
Could you perhaps give a brief explanation of how the second one works for our edification?
Many thanks again!. You saved my scalp...
Wayne
Search found 3 matches
- 04 Dec 2016 13:56
- Forum: DOS Batch Forum
- Topic: Find the last occurrence of a string in a file
- Replies: 4
- Views: 4214
- 04 Dec 2016 12:17
- Forum: DOS Batch Forum
- Topic: Find the last occurrence of a string in a file
- Replies: 4
- Views: 4214
Re: Find the last occurrence of a string in a file
Please note that the <sp><sp><sp><sp><cr> was replaced with <cr><lf> somewhere along the line when the input.txt file contents were copied/pasted/posted. Phil, your script indeed does find the last line in the pasted file. It also works on the 'correct' file. However, when I tried it on another file...
- 03 Dec 2016 09:29
- Forum: DOS Batch Forum
- Topic: Find the last occurrence of a string in a file
- Replies: 4
- Views: 4214
Find the last occurrence of a string in a file
I have text files of varying lengths similar to the following and need a Win batch solution to find the value of the last occurrence of 'time=', in this example 00:24:53.16 . Input #0, mp3, from 'test.mp3': Metadata: encoder : Lavf57.51.102 Duration: 00:23:41.31, start: 0.025057, bitrate: 128 kb/s S...