oahebky
V2EX  ›  算法

`cat /etc/group` && `cat /etc/passwd` 两个文件不是排序的,怎么排序输出?

  •  
  •   oahebky · Aug 7, 2020 · 1901 views
    This topic created in 2108 days ago, the information mentioned may be changed or developed.

    RT.

    直接 shell 命令可以实现吗?


    如果在代码中实现,使用 fp = open('/etc/group', 'r')

    用常规的排序方法排序再输出(print)吗?

    2 replies    2020-08-07 09:47:23 +08:00
    TimePPT
        1
    TimePPT  
    PRO
       Aug 7, 2020   ❤️ 1
    'sort /etc/group'
    input2output
        2
    input2output  
       Aug 7, 2020   ❤️ 1
    sort /etc/group
    或者
    cat /etc/group | sort
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2863 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 12:25 · PVG 20:25 · LAX 05:25 · JFK 08:25
    ♥ Do have faith in what you're doing.