我在该服务器上没有合适的文本编辑器,但是我需要查看是什么导致某个文件的第10行出现错误。我确实有PowerShell ...

最佳答案

就像使用select一样简单:

Get-Content file.txt | Select -Index (line - 1)

例如。得到第5行
Get-Content file.txt | Select -Index 4

或者您可以使用:
(Get-Content file.txt)[4]

关于powershell - 如何使用PowerShell打印文件的特定行?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14759649/

10-13 07:46
查看更多