sed: Use correct target if exists