You don't need for loop or awk, you can just use this
#!/bin/bash
BLK_ID=$(blkid -o device)
BLK_VAL=$(blkid -s UUID -o value);
paste <(printf %s "$BLK_ID") <(printf %s "$BLK_VAL")
The for loop you have in your example will only run once, which is why you have all the devices and then all the uuids.
You have declared BLK_ID as a single argument with one value holding all devices separated by space and i in for loop only takes that one value and loop runs only once, because you used double quotes around the variable.
What you have done in the first line is basically said
BLK_ID="/dev/sdb1 /dev/sda1 /dev/sda2 /dev/sda4"
If you use it in for loop i will not iterate through all the elements since you used double quotes around the variable, if you want to iterate through each device in the variable don't use quotes around it.
Your original code:
#!/bin/bash
BLK_ID=$(blkid | awk -F: '{print $1}')
for i in "$BLK_ID";
do
BLK_VAL=$(blkid -s UUID -o value $i);
#echo "Disk:${BLK_ID} -- UUID:${BLK_VAL}"
echo "$BLK_ID $BLK_VAL"
done
Your code with minimal changes, using awk and for loop would have to look like this:
#!/bin/bash
BLK_ID=$(blkid | awk -F: '{print $1}')
for i in $BLK_ID;
do
BLK_VAL=$(blkid -s UUID -o value $i);
#echo "Disk:${BLK_ID} -- UUID:${BLK_VAL}"
echo "$i $BLK_VAL"
done
But the awk and for loop are unnecessary, you can just use the three lines of code in the beginning of my answer.