79333678

Date: 2025-01-06 16:26:32
Score: 1
Natty:
Report link

Explanation:

•   findstr "not found /source": Filters lines containing /source.
•   for /F "tokens=3 delims= ": Extracts the 3rd token (file path).
•   for /F "tokens=* delims=/": Splits the file path by / and extracts the last token.
•   %~nB: Extracts just the file name (without extension).
  1. Remove Duplicates

Pipe the output to sort /unique to remove duplicates:

findstr "/source" logfile.txt ^ | for /F "tokens=3 delims= " %A in ('findstr "/source" logfile.txt') do @for /F "tokens=* delims=/" %B in ("%A") do @echo %~nB ^ | sort /unique

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @for
  • User mentioned (0): @echo
  • Low reputation (1):
Posted by: rihab BJ