从 shell 输出中获取值
Get the Vaule from shell output
shell 命令的输出如下。我怎样才能只获得 "UUID" 值 "72b11d-c808-455d-b684-fdc77cb596" 。有人可以帮助我吗?
/dev/sdc1: UUID="72b11d-c808-455d-b684-fdc77cb596" TYPE="ext4" PARTUUID="ac212435-01"
期望的输出“72b11d-c808-455d-b684-fdc77cb596”
$ echo '/dev/sdc1: UUID="72b11d-c808-455d-b684-fdc77cb596" TYPE="ext4" PARTUUID="ac212435-01"' | cut -d= -f2 | cut -d' ' -f1
"72b11d-c808-455d-b684-fdc77cb596"
shell 命令的输出如下。我怎样才能只获得 "UUID" 值 "72b11d-c808-455d-b684-fdc77cb596" 。有人可以帮助我吗?
/dev/sdc1: UUID="72b11d-c808-455d-b684-fdc77cb596" TYPE="ext4" PARTUUID="ac212435-01"
期望的输出“72b11d-c808-455d-b684-fdc77cb596”
$ echo '/dev/sdc1: UUID="72b11d-c808-455d-b684-fdc77cb596" TYPE="ext4" PARTUUID="ac212435-01"' | cut -d= -f2 | cut -d' ' -f1
"72b11d-c808-455d-b684-fdc77cb596"