[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51560: Pattern matching not working as expected
From: |
Rob Dyck |
Subject: |
bug#51560: Pattern matching not working as expected |
Date: |
Mon, 01 Nov 2021 14:17:19 -0700 |
Context:
sed (GNU sed) 4.8
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
Paolo Bonzini, Jim Meyering, and Assaf Gordon.
This sed program was built with SELinux support.
SELinux is enabled on this system.
The problem:
I am filtering the multi-line output if the ipcal command.
The full outlook looks like --
ipcalc dead:beef::/64
Full Network: dead:beef:0000:0000:0000:0000:0000:0000/64
Network: dead:beef::/64
Netmask: ffff:ffff:ffff:ffff:: = 64
Address space: Reserved
HostMin: dead:beef::
HostMax: dead:beef::ffff:ffff:ffff:ffff
Hosts/Net: 2^(64) = 18446744073709551616
The following example is a simplified version of what I originally was trying
to do.
Extract the lines that start with Network
This works as expected --~]$ ipcalc dead:beef::/64 | sed -n '/^Netwo*/p'
Network: dead:beef::/64
So ^Netwo* finds the only line that starts with Network.
My reasoning is that ^Netw shoud give the same result ( elimate o ).
But no
ipcalc dead:beef::/64 | sed -n '/^Netw*/p'
Network: dead:beef::/64
Netmask: ffff:ffff:ffff:ffff:: = 64
Netmask get pulled in.
I realize that sed can use various inputs to accomplish a task so I am not
really interested
here in other methods.
Why does ^Netw* match Netmask?
Am I missing something rather fundamental or is this a bug?
- bug#51560: Pattern matching not working as expected,
Rob Dyck <=