adjusted variable expansion in sed statement