Q: grep reg expression

Discussion in 'Programming/Scripts' started by edge, Oct 9, 2015.

  1. edge

    edge Active Member Moderator

    I'm trying to "grep" the 2.21 MiB value from the 3g-3G interface.
    Anyone here who might know how a reg expression for this looks like?

    Code:
      rx  /  tx  /  total  /  estimated
     3g-3G:
      Oct '15  1.85 MiB  /  369 KiB  /  1.35 MiB  /  0 KiB
      today  1.85 MiB  /  369 KiB  /  2.21 MiB  /  --
     eth0:
      Oct '15  7.51 MiB  /  508 KiB  /  8.01 MiB  /  0 KiB
      today  7.51 MiB  /  508 KiB  /  8.01 MiB  /  --
     br-lan:
      Oct '15  913 KiB  /  9.62 MiB  /  10.51 MiB  /  0 KiB
      today  913 KiB  /  9.62 MiB  /  10.51 MiB  /  --
     
  2. Gabri Shally

    Gabri Shally New Member

    grep -Poz '3g-3G:[^:/]+/[^:/]+/[^:/]+/[^:/]+/[^:/]+/\s*\K[^:/]+'
     
    edge likes this.
  3. edge

    edge Active Member Moderator

    Thank you..
    I've really got to learn this regular expression stuff!
     

Share This Page