tamamaxox
V2EX  ›  问与答

关于 grep,awk,sed 的 bash 问题

  •  
  •   tamamaxox · Apr 3, 2014 · 2596 views
    This topic created in 4452 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   ·   4487 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 10:04 · PVG 18:04 · LAX 03:04 · JFK 06:04
    ♥ Do have faith in what you're doing.