I'm trying to use grep to parse out a string property on the command line. I'm getting the properties using:
jarrett@jarrett-g74s:~$ xinput --list-props "FSPPS/2 Sentelic FingerSensingPad"
Device 'FSPPS/2 Sentelic FingerSensingPad':
Device Enabled (131): 0
Coordinate Transformation Matrix (133): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (257): 0
Device Accel Constant Deceleration (258): 1.000000
Device Accel Adaptive Deceleration (259): 1.000000
Device Accel Velocity Scaling (260): 10.000000
Device Product ID (248): 2, 15
Device Node (249): "/dev/input/event9"
Evdev Axis Inversion (261): 0, 0
Evdev Axes Swap (263): 0
Axis Labels (264): "Rel X" (141), "Rel Y" (142)
Button Labels (265): "Button Left" (134), "Button Middle" (135), "Button Right" (136), "Button Wheel Up" (137), "Button Wheel Down" (138), "Button Horiz Wheel Left" (139), "Button Horiz Wheel Right" (140), "Button Unknown" (251), "Button Unknown" (251), "Button Forward" (254), "Button Back" (255), "Button Unknown" (251), "Button Unknown" (251), "Button Unknown" (251), "Button Unknown" (251)
Evdev Middle Button Emulation (266): 0
Evdev Middle Button Timeout (267): 50
Evdev Third Button Emulation (268): 0
Evdev Third Button Emulation Timeout (269): 1000
Evdev Third Button Emulation Button (270): 3
Evdev Third Button Emulation Threshold (271): 20
Evdev Wheel Emulation (272): 0
Evdev Wheel Emulation Axes (273): 0, 0, 4, 5
Evdev Wheel Emulation Inertia (274): 10
Evdev Wheel Emulation Timeout (275): 200
Evdev Wheel Emulation Button (276): 4
Evdev Drag Lock Buttons (277): 0
The property is Device Enabled
. So, I use grep like so:
jarrett@jarrett-g74s:~$ xinput --list-props "FSPPS/2 Sentelic FingerSensingPad" | grep "Device Enabled (131):"
Device Enabled (131): 0
Which works. However, I want to grep on the whole property string (including either the 0 or 1 at the end), so I try this:
jarrett@jarrett-g74s:~$ xinput --list-props "FSPPS/2 Sentelic FingerSensingPad" | grep "Device Enabled (131):*0"
However, that returns nothing. I put a *0
, which I would have thought would cover any characters before the 0. Anyone have any idea why this won't work? (I'm new to bash work, I'm actually running this in a bash script, but I've run it in the command line as well for testing and it still doesn't work).
I appreciate any help!!
Cheers
That would be correct for a shell glob, but not for a regex; .*
matches any number of any character, although you might prefer " *"
(without the quotes, which I put in only because the space wouldn't be visible otherwise) for any number of spaces. What you have, :*0
, would match zero or more colons immediately before a 0
.