On 2019-11-28 05:51, ToddAndMargo via perl6-users wrote:
Hi All,
I have a situation where I can see two different strings:
"xxx yyyy zzz"
"avcde fg hi jklmx"
"fg hi" only has one space in the middle.
All the words have multiple spaces between them.
Is there a way I can tell words that I want "fg hi" to
be considered one word? A way to make the separator
two or more spaces?
Many thanks,
-T
This is the actual command I am dealing with. This
command gived me a partition's UUID (DeviceID), the
partition's label (Label), and the drive letter (Name).
Note: the name of an unmounted drive is its UUID:
C:\NtUtil>wmic.exe volume get deviceid,label,name
DeviceID Label Name
\\?\Volume{c9b182e9-96a0-11e2-9a72-806e6f6e6963}\ System Reserved
\\?\Volume{
c9b182e9-96a0-11e2-9a72-806e6f6e6963}\
\\?\Volume{e20f10e6-6b04-4748-b7b8-2704997af1f1}\ KVM-W7-Backup M:\
\\?\Volume{c9b182ea-96a0-11e2-9a72-806e6f6e6963}\ DRIVE_C C:\
\\?\Volume{5efeb388-02e8-11e8-9297-806e6f6e6963}\ D:\
\\?\Volume{4084e22f-03c2-11e9-bb20-806e6f6e6963}\ virtio-win-0.1.1 E:\
You will notice that "System Reverved" is the item with
a space in it.
And, that the positioning is different for Windwos 7
and Windows 10:
$DeviceID = $Line.substr(0..48);
# w7
# $Label = $Line.substr(51..66);
# $Name = $Line.substr(69..71);
# w10
$Label = $Line.substr(51..58).trim;
$Name = $Line.substr(61..63);
or I would just cut out what I needed.
Now I can check which version of Wndows I am in, but
I wanted to make it seamless such that I constantly
did not have to check Windows version. (W10 gets a
new build every six months.)
I suppose I could extract the UUID amd then erase it
from the stinng, the extract everything starting
with a double space to the Name and remove it from
the string. Trim what was left and that would
be the Label. Hmmmmm Seems to me Perl has though
of a way around this already.