How to print a certain line of a file with PowerShell?

后端 未结 6 1130
野趣味
野趣味 2020-12-13 02:49

I don\'t have a decent text editor on this server, but I need to see what\'s causing an error on line 10 of a certain file. I do have PowerShell though...

6条回答
  •  -上瘾入骨i
    2020-12-13 03:13

    This will show the 10th line of myfile.txt:

    get-content myfile.txt | select -first 1 -skip 9

    both -first and -skip are optional parameters, and -context, or -last may be useful in similar situations.

提交回复
热议问题