#!/bin/bash
s="system.switch_cpus_1.commit.refs              2682887                       # Number of memory references committee"
echo "$s" | grep -Ewo '[0-9]+'
echo "-------------"
echo "$s" | grep -Eo '\b[0-9]+\b'
echo "-------------"
echo "$s" | grep -Eo '\<[0-9]+\>'