Tenth Line

  • Problem
    How would you print just the 10th line of a file?
    For example, assume that file.txt has the following content:
    Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10
    Your script should output the tenth line, which is:
    Line 10

  • code
    # Read from the file file.txt and output the tenth line to stdout.
    sed -n "10p" file.txt

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Question: How would you print just the 10th line of a fil...
    W有来有去阅读 178评论 0 0
  • 1.创建文件夹 !/bin/sh mkdir -m 777 "%%1" 2.创建文件 !/bin/sh touch...
    BigJeffWang阅读 10,145评论 3 53
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,906评论 0 0
  • 我从来没有怀疑过父母不爱我,只是觉得他们没有那么爱我。 小时候爸爸长期在外打工,其中有三四年还去了国外做苦工,妈妈...
    椭圆君阅读 222评论 0 0
  • 這時代可能真無法販賣情懷,因為: 無情懷者的情懷不值分文 有情懷者的情懷無價可沽
    憨憨爹阅读 141评论 0 0