Read the last 50 lines on files with specific word

I have the one below, but need to retrieve the lines with specific word…

I dont need the whole information on the file just the last 50 lines, but with specific word.

items 1 of ( item 1 of it, (lines of item 0 of it) ) whose ( (line number of item 1 of it) > ( item 0 of it - 50 /* ← This is the number of lines to return, which is subtracted from the total # of lines ← */ ) ) of (it, number of lines of it ) of files “C:\Windows\SysWOW64\rserver30\Radm_log.htm”

Can you help me on it?

This could mean two different things, I want to be sure I’m understanding correctly.

  • The lines that contain “some word”, only among the last fifty lines of the file?

  • The last fifty lines containing “some word”, wherever those lines are in the file?

i.e. in a 100-line file with two instances of the word, on the first line and on the last line, the first approach would only return the last line of the file; since the search is filtered to the last fifty lines of the file, the instance on line 1 would be excluded.

In the same 100-line file, the second approach would return both lines.

Is…this the same use-case discussed last week at Improving relevance efficiency - #3 by JasonWalker ?

Thanks for the feedback…

would be the one below:

  • The last fifty lines containing “some word”, wherever those lines are in the file.

is it possible to help me on it?

no would be diferente…

he last fifty lines containing “some word”, wherever those lines are in the file

Your best bet would be to run an Action to use shell commands to filter the file into a new file containing only the lines of interest, and then use Relevance to read the last fifty lines from the file.

In Relevance we could read the last fifty lines and then filter to those containing the word, but we don’t have a good way to find all lines containing the word and then filter to the last fifty results (we don’t have indexes or ordering of the plural results).

Shellscript might be something like

waithidden cmd.exe /c "find /i "someword" "c:\temp\some-file.txt" > "c:\temp\output-file.txt" "

or

wait grep -i "someword" /tmp/some-file.txt > /tmp/output-file.txt