in reply to Read UUID on macOS from script
Short answer: you need to escape the backslash.
Long answer: Never shell out from perl to run awk (see Hippo's Law of Perl). Instead do something like this:
($UUID) = map { (split (/"/, $_))[-1] } grep { /IOPlatformUUID/ } `ior +eg -d2 -c IOPlatformExpertDevice`; print $UUID;
Untested, because I don't have ioreg installed here but you should hopefully get the gist. Equivalent SSCCE:
#!/usr/bin/env perl use strict; use warnings; my ($UUID) = map { (split (/"/, $_))[-1] } grep { /IOPlatformUUID/ } ' +IOPlatformUUID = "foo"'; print "$UUID\n";
🦛
|
|---|