Code:
> STRING='/dev/hdb 117217216 93883264 23333952 81% /data'
> echo ${STRING} | cut -f 5 -d" " | sed 's/%//'
81
I used an echo command as the source of the string, but you could probably use a file instead.
The
cut command selects the fifth field, while the
sed command removes the percent sign.
You might also use an
awk filter instead. It is better than sed at selecting fields from the input.