From http://stackoverflow.com/questions/35965783/delete-all-lines-before-first-occurrence-of-specific-string-in-file
# remove before somestring, retaining somestring awk '/somestring/,0' file > deleted_file # remove after someotherstring, including someotherstring sed -n '/someotherstring/q;p' chrM.fa.del1 > chrM.fa.del2