I’m working on bash script getting the pci nvme address for hot reset.
I want to parsing for pci express nvme ADDRESS (i.e /sys/devices/pci0000:00/0000:00:01.2/0000:01:00.2/0000:02:00.0/0000:03:00.0/nvme/nvme0
how can i do this?
I want to parse the address value before nvme.
You can use
/ as the delimiter.
addr='/sys/devices/pci0000:00/0000:00:01.2/0000:01:00.2/0000:02:00.0/0000:03:00.0/nvme/nvme0' nvme=$(cut -d/ -f8 <<<"$addr") echo "$nvme"
Answered By – Barmar