• 请不要在回答技术问题时复制粘贴 AI 生成的内容
darasion
V2EX  ›  程序员

shell 的输出,如何排版?怎样使不同行的相应列对齐?

  •  
  •   darasion · May 23, 2012 · 14309 views
    This topic created in 5115 days ago, the information mentioned may be changed or developed.
    怎样使不同行的相应列对齐?有什么技巧吗?

    对齐的例子:
    a b c
    1 2 3

    没对齐的例子:
    a b c
    1 222222222222222222222 3
    4 replies    1970-01-01 08:00:00 +08:00
    tioover
        1
    tioover  
       May 23, 2012
    Printf()有相应的参数的
    cfddream
        2
    cfddream  
       May 23, 2012
    \t
    echo -en 'sd \tjflds\nsfdf \tfdsfds\n'
    9hills
        3
    9hills  
       May 23, 2012
    分隔符用\t(制表符)而不是空格
    gDD
        4
    gDD  
       May 23, 2012   ❤️ 2
    mount | column -t

    man column
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1099 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:11 · PVG 02:11 · LAX 11:11 · JFK 14:11
    ♥ Do have faith in what you're doing.