tamamaxox
V2EX  ›  问与答

关于 grep,awk,sed 的 bash 问题

  •  
  •   tamamaxox · Apr 3, 2014 · 2572 views
    This topic created in 4442 days ago, the information mentioned may be changed or developed.
    在命令行中print出的信息中,如何获取 delay 后面的 1.00 , 0.10 这个数字,并且,在没有delay的行里沿用上面一下的数字。不带s。

    。。。嗯,感觉好复杂。

    disposal asis delay 1.00s
    disposal asis
    disposal asis
    disposal asis
    disposal asis
    disposal asis
    disposal asis
    disposal asis delay 1.00s
    disposal asis delay 0.10s
    disposal asis delay 0.10s
    disposal asis delay 0.10s
    1 replies    1970-01-01 08:00:00 +08:00
    kfll
        1
    kfll  
       Apr 3, 2014   ❤️ 1
    | awk '{if ($4) a=$4; printf "%.2f\n",a}'
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2167 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 00:01 · PVG 08:01 · LAX 17:01 · JFK 20:01
    ♥ Do have faith in what you're doing.