sed: change only first occurance of a term in a file Mar 16, 2011 • Noel So in the example here, we look for the first line beginning with ALERT and puts 2 return chars after the line sed -r '0,/(^ALERT.*)/s//\1\n\n/'