2013-10-04 41 views
0

是否可以從文件中獲得15條底線?我正在談論SQL中的ERRORLOG,默認情況下沒有像.txt或類似的文件擴展名。使用get-content創建文件中最新的15行(條目)?

我想過獲取內容和篩選最後的條目。 我去get-help get-content和我得到這個不錯的信息:

開始在Windows PowerShell中3.0,獲取內容也可以從項目的開始或結束線的 指定數量。

這正是我想要的,但獲取幫助並沒有告訴我它是如何工作的。所以我需要你! 指着

回答

1

我認爲你需要的-tail參數:

get-content file.txt -Tail 15 
+0

感謝,我也剛剛發現我可以使用-last 15以及:) – RayofCommand

+0

有也PowerShell 2.0中一個可能的解決方案? – RayofCommand

+0

是的,看我和喬伊的答案[這裏](http://stackoverflow.com/questions/13624403/using-powershell-to-search-for-specific-strings-in-the-last-x-lines-of- very-larg/13625108#13625108) – nimizen

相關問題