save before attempting string replace bash