I'm trying to get a variable from /var/log/messages when the string "Attached" appears in /var/log/messages.
I've got so far, and stuck:
sudo stdbuf -o0 tail -f -n0 /var/log/messages | awk '{if ($9 == "Attached") print$8}'
This gives the usb device dev id eg [sdc] when a USB device is plugged in. FRom here I plan to mount the device as exfat. I'm using Centos 7, which does not automount exfat. fuse-exfat and exfat-utils are installed.