With JQ installed - output of this command is string with quotes
xcrun simctl list --json | jq '.devices["iOS 12.0"] [] | select(.name=="iPhone X") | .udid'
With JQ if you don't want quotes
xcrun simctl list --json | jq -r '.devices["iOS 12.0"] [] | select(.name=="iPhone X") | .udid'
Without JQ installed
xcrun simctl list | grep "Booted" | cut -d '(' -f2 | cut -d ')' -f1