alias scanfile1 {
var %text = * $+ $$1-*, %file = file.txt, %lines = $lines(%file)
var %pos = $iif(%lines < 50,0,$calc(%lines - 50))
while $read(%file,wn,%text,%pos) {
var %found = $ifmatch, %pos = $readn + 1
}
if %found { echo -a * %found }
}
alias scanfile2 {
var %text = * $+ $$1-*, %file = file.txt, %lines = $lines(%file)
var %pos = $iif(%lines < 50,0,$calc(%lines - 50))
window -h @@
filter -fwr $+(%pos,-,%lines) %file @@ %text
echo -a * $line(@@,$filtered)
close -@ @@
}
Pick your favorite (I prefer the latter) and use: /scanfileN text