Linux Command - split single line into multiple lines

A

ALEXTANG

Guest
My content of my input file - gene.data look like this:
tang 123 gene gene 3000 1000 4000


where
the 1st column is the name of the gene
the 2nd column is the id of the gene
the 3rd and 4th column are the type of sequence
the 5h column is the size of the gene in base pair.
the 6th column is the starting point of the gene location;
the 7th column is the end point of the gene location.

I would like to divide this line into multiple lines of 600 base pairs each until/before the ending point.

i want the result like this:
tang 123 gene gene 600 1000 1600
tang 123 gene gene 600 1600 2200
tang 123 gene gene 600 2200 2800
tang 123 gene gene 600 2200 2800
tang 123 gene gene 600 2800 3400
tang 123 gene gene 600 3400 4000

what should I do in order to come out these result? can I just write a command line or need to write a script?
 


My content of my input file - gene.data look like this:
tang 123 gene gene 3000 1000 4000


where
the 1st column is the name of the gene
the 2nd column is the id of the gene
the 3rd and 4th column are the type of sequence
the 5h column is the size of the gene in base pair.
the 6th column is the starting point of the gene location;
the 7th column is the end point of the gene location.

I would like to divide this line into multiple lines of 600 base pairs each until/before the ending point.

i want the result like this:
tang 123 gene gene 600 1000 1600
tang 123 gene gene 600 1600 2200
tang 123 gene gene 600 2200 2800
tang 123 gene gene 600 2200 2800
tang 123 gene gene 600 2800 3400
tang 123 gene gene 600 3400 4000

what should I do in order to come out these result? can I just write a command line or need to write a script?
You can do this in any language you prefer :D
 

Members online


Latest posts

Top