mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
Create netstat.nu
This commit is contained in:
parent
c0df9802c0
commit
1b25883d21
1 changed files with 17 additions and 0 deletions
17
examples/netstat.nu
Normal file
17
examples/netstat.nu
Normal file
|
@ -0,0 +1,17 @@
|
|||
let ns = (netstat | lines | skip 1)
|
||||
|
||||
let first-batch = ($ns | keep until $it =~ Active | str collect (char nl) | from ssv -m 1)
|
||||
let second-batch = ($ns |
|
||||
skip until $it =~ Active |
|
||||
skip 1 |
|
||||
str collect (char nl) |
|
||||
str find-replace "\[ \]" "[]" --all |
|
||||
from ssv -m 1 |
|
||||
default I-Node "" |
|
||||
default Path "" |
|
||||
each {|row| if $row.Type == DGRAM { $row | update Path { get I-Node } | update I-Node { get State } | update State "" } { $row } }
|
||||
)
|
||||
|
||||
$first-batch
|
||||
|
||||
$second-batch
|
Loading…
Add table
Add a link
Reference in a new issue