Relevance help with last occurrence of string in file

Hey folks, quick one for you. I’m just trying to parse the last FW version value from a file. There are multiple instances of this, but I only need the last instance. The filename is c:\temp\handscanner.txt. Probably very easy, but I’m not getting it. Any help would be appreciated, thank you.

File content sample is below, and the line count is not the same for each device. I need to be able to keep on just that last occurrence.

blah
B:PAACYS00-003-R02
blah
B:PAACYS00-003-R06
B:PAACYS00-003-R08

q: following texts of last "B:" of line whose (it starts with "B:") of file "c:\temp\handscanner.txt"
A: PAACYS00-003-R02
E: Singular expression refers to non-unique object.

Not as simple as it sounds, but I think this should do…

Following texts of firsts "B:" of lines (maximum of line numbers of lines starting with "B:" of it) of files "path\to\filename"
2 Likes

thanks Jason, that did the trick.

1 Like