I'd like to get the quoted string from output of lvscan
which is :
ACTIVE '/dev/mysys/root' [297.46 GiB] inherit
What I've done is to use code below:
lvscan | grep -o "[^']\+\b'"
and what I got is :
/dev/mysys/root'
if I remove the very last single quote, I got three lines:
ACTIVE
/dev/mysys/root
[297.46 GiB] inherit
I also tried:
lvscan | grep -o "[@(^'\+.*)].*\>'"
lvscan | grep -o "[^']\+\>'"
What did I miss here?
Any comments would appreciate. Thank you.
if you have -P
with grep
you can use
lvscan | grep -oP "(?<=')[^']+(?=')"