swapped sed for awk

This works perfectly.