LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-11-2015, 06:46 PM   #1
Rozak
LQ Newbie
 
Registered: Sep 2015
Posts: 23

Rep: Reputation: Disabled
data manipulation in linux: how to make columns from rows in linux


I have a big data.txt file like this:
Code:
6712,04444
6712,02344
6712,02220
6712,02233
5322,00040
5322,02230
5322,42002
4444,03342
4444,03323
11,42023
11,00000
11,23443
11,23232
and then I want to make a data.txt like this from the original one:
Code:
col6712  col5322  col4444   col11
04444     00040    03342    42023
02344     02230    03323    00000
02220     42002             23443 
02233                       23232
In fact I want the first column of the original file be the column number and the inside of each row in original file be underneath of their related column. is there any command in Linux that I could reach my goal?

Last edited by Rozak; 09-11-2015 at 06:58 PM.
 
Old 09-11-2015, 06:53 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by Rozak View Post
0

down vote

favorite
Copy-and-paste error?

http://unix.stackexchange.com/q/229170
 
Old 09-11-2015, 06:58 PM   #3
Rozak
LQ Newbie
 
Registered: Sep 2015
Posts: 23

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
yes sorry! I wil edit it now
 
Old 09-12-2015, 02:07 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
Try awk, perl, ruby or python
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to convert the rows of data into the columns? w1k0 Programming 101 02-06-2014 09:24 PM
[SOLVED] rows and columns in data(matrix) trimming command smart1seo Linux - Newbie 8 04-11-2013 04:04 PM
Convert columns of data into rows jaufer Linux - Software 3 06-29-2010 05:19 PM
How to print data in rows and columns suran Linux - General 3 03-15-2009 02:53 PM
text data conversion: rows into columns frankie_DJ Programming 6 06-03-2006 06:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:15 AM.

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