#!/usr/bin/perl -w use strict; use warnings; while(){ if (/.*/) { print; } if (/>JN.*/) { print; } } __DATA__ file.txt .... .... ... file.txt >JN....