With awk:
awk 'NR==1{for(i=1;i<NF;i++){if($i=="OS_NATIVE_NAME"){s=index($0,$i); l=index($0,$(i+1))-s}}} $1=="disk_0"{print substr($0,s,l)}' file NR==1if it's the first line (the header line),NRis awks internal variable for the current line number being processed.for(i=1;i<NF;i++)loop trough the fields.NFis awks internal variable for the number of fields in the current line.$i=="OS_NATIVE_NAME"since, we're looping trough each field, check if the field value equalsOS_NATIVE_NAME.s=index(...)find the position of the start of the field and save it for later.index()is awks string function to get the position of the occurence of a string (here the value of $i, henceOS_NATIVE_NAME) in another string (here$0, hence the whole line).l=index(...)-sandget the length of the field and save it for later: same priciple as before, but to get the length we must substractsfrom it.$1=="disk_0"find theDEVICEyou are searching in the first field (disk_0in the example).$1represents the first field.{print substr($0,s,l)}finally print for each line, the string started at positions, with lengthl.substr()is awks string function to cut a string (here$0; the whole line) from positionswith lengthl(the two varibale we prevously extracted while processing line 1)
Prints (regardless of where the field is in the input):
sda