loop replaced with sed one-liner