Trying to find matching lines from 'wg' (wireguard) command output where public_keys are given which can have forward slash and/or '+' (plus) signs.
So I try: awk '$0~v' v="$peer" RS=
# peer="KDyRQuyvygoAamIMB/6RKWxyb7urysDCldIVbIM5DRQ="
# echo $peer
KDyRQuyvygoAamIMB/6RKWxyb7urysDCldIVbIM5DRQ=
# wg | awk '$0~v' v="$peer" RS=
peer: KDyRQuyvygoAamIMB/6RKWxyb7urysDCldIVbIM5DRQ=
preshared key: (hidden)
endpoint: 1.2.3.4:44529
allowed ips: 10.33.17.0/24
latest handshake: 41 seconds ago
transfer: 3.64 KiB received, 7.43 KiB sent
persistent keepalive: every 25 seconds
While the above works with forward slashes, the following does not work if public_keys/strings contain plus '+' sign:
# peer="JeMdiPUksJRpc+LNGbG9Nw/ubVSzj/eFGgrEVwp0z2w="
# echo $peer
JeMdiPUksJRpc+LNGbG9Nw/ubVSzj/eFGgrEVwp0z2w=
# wg | awk '$0~v' v="$peer" RS=
#
How would a match work in this situation?