The benefit is, that each value which I ever may need has a fixed column in the result which makes common parsing easier.
But, what's up with the SIZE column?
It seems that for all other columns, the values start at the same point as where the name of the colums starts, but SIZE seems to be right-justified (both the column nam and it's values)?
How then do you know, at what point the values of SIZE start and where they end?
Bart
I'm sorry, I gave you the wrong parameters (picked up a line which I had only used for testing purposes). I recommend to use:
lsblk -l -e 7 -oNAME,FSTYPE,UUID,PARTTYPE,TYPE,MOUNTPOINTThe result of above command looks like this:
NAME FSTYPE UUID PARTTYPE TYPE MOUNTPOINT
sda disk
sda1 ntfs 60D898E99C1DD456 0x7 part
sda2 vfat BE2A-F2D1 0xe part /media/D
sda3 0xf part
sda4 ext4 ada05431-c5b7-4241-b1a8-ecbfe2d987cb 0x83 part /
sda5 vfat 5B53-12F7 0x6 part
sda6 vfat A1FF-3DF2 0x6 part /media/F
sda7 ntfs 6532098E648037CE 0x7 part
sda8 ntfs D09567D4F718A7BA 0x7 part /media/H
sda9 vfat 4749-6ED3 0xb part /media/X
sdb disk
sdb1 ntfs 58F4C81735ED08D0 0x7 part
sdb2 ext4 0cdde00b-c715-4d01-8938-b7174f9f574d 0x83 part
sdc disk
sdd disk
sdd1 vfat 08BB-83BA 0xc part /media/hg6/NETAC
sde disk
sde1 vfat D3C0-2DE8 0xc part /media/hg6/STORE N GO
I placed colum MOUNTPOINT as the last colum, because it is the only one which can contain blanks.
Some parsing hints:
- split each line into "words" (separated by blanks)
- skip all lines which have less than 5 "words" (they have no UUID)
- if you want to find the requested line by NAME it should be easy
- if you want to find the requested line by MOUNTPOINT and if this can contain blanks in your case, then you must determine the start of the 6th "word" and use everything from this position on. Or search for the 1st "/" and use everything from this position on.
If you need more help you are welcome.