while (readline into $line) if $line starts with 'priority' replace 'priority' with 'bandwidth' if 'priority already seen' remember that priority was seen end else if $line is blank forget that priority was seen end print $line end