By using AWK can I convert matrice shaped data to a row ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting By using AWK can I convert matrice shaped data to a row ?
# 1  
Old 10-04-2010
By using AWK can I convert matrice shaped data to a row ?

Hello,

I have output in the matrice form , for example:

1 2 3 4
a b c d
jim joe sue tom


how can I convert this line-column data into a row as follows

1 2 3 4 a b c d jim joe sue tom



thank you
# 2  
Old 10-04-2010
Code:
tr '\n' ' ' < infile

Code:
awk '$1=$1' RS= infile

# 3  
Old 10-04-2010
Try this,
Code:
paste -s inputfile

# 4  
Old 10-04-2010
Code:
xargs < infile

# 5  
Old 10-04-2010
thank you all, I am trying the codes
# 6  
Old 10-04-2010
Code:
$ ruby -00 -ne 'puts $_.split.join(" ")' file
1 2 3 4 a b c d jim joe sue tom

# 7  
Old 10-05-2010
Pravin, Scrutinizer and Kurumi thank you very much... Is it possible to convert it to a column data like:

1
2
3
4
a
b
.
.
.

best regards
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get row data printed in column using awk?

Hi team, I have below sample file. $ cat sample dn: MSISDN=400512345677,dc=msisdn,ou=NPSD,serv=CSPS,ou=servCommonData,dc=stc structuralObjectClass: NphData objectClass: NphData objectClass: MSISDN entryDS: 0 nodeId: 35 createTimestamp: 20170216121047Z modifyTimestamp: 20170216121047Z... (3 Replies)
Discussion started by: shanul karim
3 Replies

2. Shell Programming and Scripting

Convert Data from Column to Row

Hi FileA.txt E_TIM 16, ETE 15, EOND 26, EEC 81, E_1 un, E_2 un, E_3 un, E_4 284, E_TIM 17, ETE 15, EOND 29, EEC 82, E_1 un, E_2 un, E_3 un, E_4 249, (6 Replies)
Discussion started by: asavaliya
6 Replies

3. Shell Programming and Scripting

Convert columns to row using awk

Hi I need to convert some columns form a html file to rows. I do manage to make it works without help (some proud :) ) For some reason the offline status is not in bold, so I do need to remove the <b> tag from the other field to make this to work. All fields are not needed, so I test and... (5 Replies)
Discussion started by: Jotne
5 Replies

4. UNIX for Advanced & Expert Users

Convert column data to row data using shell script

Hi, I want to convert a 3-column data to 3-row data using shell script. Any suggestion in this regard is highly appreciated. Thanks. (4 Replies)
Discussion started by: sktkpl
4 Replies

5. UNIX for Dummies Questions & Answers

awk: convert column to row in a specific way

Hi all! I have this kind of output: a1|b1|c1|d1|e1 a2|b2|c2 a3|b3|c3|d3 I would like to transpose columns d and e (when they exist) in column c, and under the row where they come from. Then copying the beginning of the row. In order to obtain: a1|b1|c1 a1|b1|d1 a1|b1|e1 a2|b2|c2... (1 Reply)
Discussion started by: lucasvs
1 Replies

6. Shell Programming and Scripting

How to convert 2 column data into multiple columns based on a keyword in a row??

Hi Friends I have the following input data in 2 columns. SNo 1 I1 Value I2 Value I3 Value SNo 2 I4 Value I5 Value I6 Value I7 Value SNo 3 I8 Value I9 Value ............... ................ SNo N (1 Reply)
Discussion started by: ks_reddy
1 Replies

7. Shell Programming and Scripting

Convert row data to column data

Hi Guys, I have a file as follows: a 1 b 786 c 90709 d 99 a 9875 b 989 c 887 d 111 I want: a 1 9875 b 786 989 (3 Replies)
Discussion started by: npatwardhan
3 Replies

8. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies
Login or Register to Ask a Question