From fae17644b9ef2382994bf3ce7d288e08211c42ef Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Sun, 1 Sep 2024 20:34:09 +0200 Subject: migrate more stuff --- content/posts/2019-2-24-walking-netstat-with-awk.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 content/posts/2019-2-24-walking-netstat-with-awk.md (limited to 'content/posts/2019-2-24-walking-netstat-with-awk.md') diff --git a/content/posts/2019-2-24-walking-netstat-with-awk.md b/content/posts/2019-2-24-walking-netstat-with-awk.md new file mode 100644 index 0000000..1094bce --- /dev/null +++ b/content/posts/2019-2-24-walking-netstat-with-awk.md @@ -0,0 +1,18 @@ +--- +layout: post +title: Walking /proc/net/netstat like a pro with awk +category: GNU/Linux +tags: + - networking +--- + +Little snippet to parse `/proc/net/netstat` and format the output: + +```bash +awk '{for(i=1;i<=NF;i++)title[i] = $i; getline; print title[1]; for(i=2;i<=NF;i++)printf " %s: %s\n", title[i], $i }' /proc/net/netstat + +TcpExt: + ... +IpExt: + ... +``` -- cgit v1.2.3