Unix: Avoiding repetitious work with sed