Wednesday, April 9, 2014

Extracting the specific content line from huge log file using PowerShell command

Sometimes it will so be difficult to search a line which it has the specific word or content using Ctrl+F in the huge log file. Found out a easiest way that will very much useful for our daily task

  Winstore

For Example: I want to search the line which hold the word “Build” in the text file winstore.log.

PS C:\Temp> dir .\Winstore.LOG | Select-String "Build"

Powershell

If you want to search in multiple file

PS C:\Temp> dir .\Winsto*.LOG | Select-String "Build"

If you want to export the output to text file

PS C:\Temp> dir .\Winsto*.LOG | Select-String "Build" > Output.txt

Select-String Powershell

Note: You can’t get output if you used Export-CSV cmdlet & this search can be done only notepad format files

No comments:

Post a Comment

The blog is written to the share the knowledge mainly on Microsoft Exchange Server and other Microsoft product that experienced on day-to-day life.