thanks so much for the code. It works great!!..but i did a very minor change to the code as i have another issue that i didn't show in the sample. actually, not all line use ">start_xxx". So, i change it to ">kump" and add "!" in front of P in your code as follows:
@R.Singh
Must be > not \> . The latter has a special meaning "right word boundary" in many sed versions.
Here is another sed solution (IMHO ugly compared to the awk solution):
sed -n -e '${x;p;x;p;}' -e '/^>kump/{g;1!p;}' -e 'H;/^>/h' file
This is wrong since it modifies line outside of the designated range by indiscriminately deleting dots.
If, as I suspect, the dots in the data are placeholders for irrelevant data, then this solution which depends on literal dots is wrong in a second way.
Regards,
Alister
---------- Post updated at 01:14 PM ---------- Previous update was at 12:27 PM ----------
I'm curious. Besides GNU (and perhaps Busybox, which emulates GNU whenever their minimalist mission allows), which sed implementations support \> ?
That sed script is not equivalent to the awk solution. If the data ends when in mid-range, it will print (accumulated) lines which the awk alternative would not have.
Not a one-liner, but it's the most straightforward approach which behaves analogously: