Bash tool to get nth line from a file

前端 未结 19 2386
刺人心
刺人心 2020-11-22 08:07

Is there a \"canonical\" way of doing that? I\'ve been using head -n | tail -1 which does the trick, but I\'ve been wondering if there\'s a Bash tool that speci

19条回答
  •  野性不改
    2020-11-22 09:03

    You can also use Perl for this:

    perl -wnl -e '$.== NUM && print && exit;' some.file
    

提交回复
热议问题