|
Answer» I have a report which is on my c: drive and I want to create a batch file which will take me to the LAST page of this report which contains the phrase Totals and display it.Not really ENOUGH details, but you might use the find command:
CODE: [Select]find /i "totals" c:\yourfilenamehere
This will find all occurrences of "Totals" so if you can make the search argument more UNIQUE, by all means do so.
remember though that there may be many "Totals" phrases in the document. the only way to view it ENTIRELY is 2 use the type command.if you can download and install gawk from here:
Code: [Select]# save the below code as script.awk /Totals/{ last=$0 } END{ print last } output:
Code: [Select]C:\test>more new.txt line 1 Totals 1 line 3 Totals 2
C:\test>gawk -f script.awk new.txt Totals 2
|