#!/bin/bash
s='width: 9%, width: 22%, width: 100%'
 perl -pe 's/width: (\d+)%/sprintf "width_%03s", $1/ge' <<< "$s"