LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 09-16-2014, 08:10 AM   #1
ALEXTANG
LQ Newbie
 
Registered: Sep 2014
Posts: 2

Rep: Reputation: Disabled
Linux Command - split single line into multiple lines


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?
 
Old 09-16-2014, 09:17 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator Response

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate of https://www.linuxquestions.org/quest...es-4175519024/
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Split single line into multiple lines with 3 column each udiubu Programming 7 11-26-2017 09:41 AM
Linux Command - split single line into multiple lines ALEXTANG Linux - General 1 09-16-2014 01:19 PM
split a line into multiple lines santhosh_cv Programming 7 08-17-2012 11:54 AM
UNIX shell script: split long command on multiple lines loopoo Linux - Newbie 2 10-23-2006 09:34 AM
merge multiple lines of a single file into one line groverrajiv Linux - Newbie 4 05-26-2004 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration