In the above command, PowerShell Get-Content cmdlet -tail parameter gets last 50 lines of the code. To get tail of last 50 lines of big file and export it csv file, use the below command Get-Content "C:\PowerShell\EventLog_Setup.txt" -tail 50 | Out-File -FilePath "C:\PowerShell\output.csv" Often administrators need to extract few lines from the big log file to analyze the log data. Here -tail 1 show the bottom line of the file Get-Content "C:\PowerShell\EventLog_Setup.txt" -tail 1Ĭool Tip: Do you know the equivalent of cat command in Windows! Get tail of the big file and export to csv To get last line of the file, use tail parameter with the value 1. PowerShell tail – Show last line of the file The above get-content tail command output show the last 3 lines of the file. Get-Content "C:\PowerShell\EventLog_Setup.txt" -tail 3 To get the last 10 lines of the Windows Event log, use the below Get-Content tail parameter. Let’s understand using Get-Content tail examples to read end of the file, a file can be iis log file, windows event log, firewall log, or any other file.Ĭool Tip: How to get certificates using PowerShell! Using PowerShell tail of Window Event log
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |