V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
samuel40
V2EX  ›  问与答

Linux 如何显示某一行之后的输出

  •  
  •   samuel40 · 2015-11-11 13:42:26 +08:00 · 2808 次点击
    这是一个创建于 3087 天前的主题,其中的信息可能已经有所发展或是发生改变。

    执行一条指令,比如会输出 100 行,第 50 行有个关键字,我想直接从第 50 行开始看,前面全部不输出, Linux 有这样的命令吗?

    5 条回复    2015-11-11 16:48:59 +08:00
    harry890829
        1
    harry890829  
       2015-11-11 13:45:11 +08:00
    shell 命令的话,配合 grep 过滤?
    easynoder
        2
    easynoder  
       2015-11-11 13:52:17 +08:00
    管道配合 grep 吧
    samuel40
        3
    samuel40  
    OP
       2015-11-11 13:54:18 +08:00
    @harry890829 找到了,感谢~
    notsobad
        4
    notsobad  
       2015-11-11 14:28:48 +08:00
    cat /etc/passwd | awk '/^bin/,0{print}'
    sunjourney
        5
    sunjourney  
       2015-11-11 16:48:59 +08:00
    awk 'NR >= 50' /etc/passwd
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3308 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 84ms · UTC 11:46 · PVG 19:46 · LAX 04:46 · JFK 07:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.