I have found an answer that gives the list of files in powershell here
How to search a string in multiple files and return the names of files in Powershell?
but I need to know the line number and line text also where that text is found. After this I need to write the output to an excel or csv.
edit: Get-ChildItem -recurse | Select-String -pattern "ftp" | Write-Host script is giving me the output as C:\codes\prog1.txt:10:FTP but I want the output as path - C:\codes\prog1.txt line number-10 Line text-FTP "server1" in Excel