Command to get nth line of STDOUT

前端 未结 12 1796
闹比i
闹比i 2020-12-07 07:39

Is there any bash command that will let you get the nth line of STDOUT?

That is to say, something that would take this

$ ls -l
-rw-r--r--@ 1 root  wh         


        
12条回答
  •  渐次进展
    2020-12-07 08:04

    Alternative to the nice head / tail way:

    ls -al | awk 'NR==2'
    

    or

    ls -al | sed -n '2p'
    

提交回复
热议问题