Sponsored Content
Full Discussion: Transpose column to row
Top Forums Shell Programming and Scripting Transpose column to row Post 302525513 by rdcwayx on Friday 27th of May 2011 12:33:53 AM
Old 05-27-2011
Looks input file has been sorted. If not, sort it first. Smilie
Code:
awk -F , '!a[$1]++ {printf RS $1 OFS $2 ;next}{printf FS $2}' infile

If not ask for space between first and second column, the code can be more shorter.
Code:
awk -F , '!a[$1]++ {printf RS $1}{printf FS $2}' infile

This User Gave Thanks to rdcwayx For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Row to column transpose

Can we transpose rows to columns? Fields within row are separated by a comma. (10 Replies)
Discussion started by: videsh77
10 Replies

2. Shell Programming and Scripting

Row to column transpose between same pattern.

Hi All, I have been trying to transpose rows to column in an large file (about 15000 lines) between matching pattern. Searched all posts in this forum, but not able find the solution to my problem. Any help appreciated.!! Input /*------XXXXXX-------*/ owner: XXXX location: XXXX... (3 Replies)
Discussion started by: RobP
3 Replies

3. UNIX for Dummies Questions & Answers

Row to column transpose

Hi there, Below is sample three rows which i need transpose into multiple rows. By keeping first 2 fields static and split them into multiple rows depend following date field. Each into seperate rows. Sample code: ... (6 Replies)
Discussion started by: ganeshd
6 Replies

4. Shell Programming and Scripting

Column to row Transpose

Hi Folks, Iam a kinda newbie to unix shell scripting, the scenario is i have a text file containing the following info Charlie chicago 15 Charlie newyork 26 jonny chicago 14 jonny newyork 15 joe chicago 15 joe newyork 18output should be Name chicago ... (3 Replies)
Discussion started by: tech_frk
3 Replies

5. Shell Programming and Scripting

Transpose column to row - awk

Hi there, I have a small csv file example below: source,cu_001,cu_001_volume,cu_001_mass,cu_002,cu_002_volume,cu_002_mass,cu_003,cu_003_volume,cu_003_mass ja116,1.33,3024000,9374400,1.54,3026200,9375123,1.98,3028000,9385512 I want to transpose columns to rows starting at the second... (3 Replies)
Discussion started by: theflamingmoe
3 Replies

6. Shell Programming and Scripting

To transpose row into column

Hi All, In shell, I have below data coming from some some text file as below: . 351706 5861.8 0.026 0.012 12.584 0.026 0.012 12.582 0.000 0.000 0.000 Now i need the above data to be transposed as below 351706... (16 Replies)
Discussion started by: Anamica
16 Replies

7. Shell Programming and Scripting

Transpose row to column

I'm using the testawk.awk from the following thread https://www.unix.com/shell-programming-and-scripting/18897-row-column-transpose.htmlI'm getting the following output fieldname1 data1 fieldname2 data2 fieldname3 data3 How can I get like this instead 1 fieldname1 data1 2 fieldname2 data2... (1 Reply)
Discussion started by: makkan
1 Replies

8. Shell Programming and Scripting

Transpose from row to column using timestamp in first column

Gents, Transpose from row to column, taking in consideration the first column, which contends the date. Input file 72918,111000009,111000009,111000009,111000009,111000009,111000009,111000009,111000009,111000009 72918,2356,2357,2358,2359,2360,2361,2362,2363,2364 72918,0,0,0,0,0,0,0,0,0... (12 Replies)
Discussion started by: jiam912
12 Replies

9. Shell Programming and Scripting

How transpose column in a row?

Hello guys, First of all happy holidays and happy new year. I'm new in bioinformatic and also it is my first time that I write in this forum. Therefore, sorry if I make some mistakes. I'm writing to ask your help to fix a problem: I have a file like this: gene1 GO:0016491|GO:0055114... (8 Replies)
Discussion started by: Salvatore_espos
8 Replies

10. UNIX for Beginners Questions & Answers

Transpose the Row and column

Hi, I have data in form of A ram B shyam C seeta D geeta A bob B methew C Richad D Mike and i want it in this form. A B C D ram shyam seeta geeta bob methew Richard Mike. please help by providing the scripting for this. (3 Replies)
Discussion started by: ricbha
3 Replies
sgtts2.f(3)							      LAPACK							       sgtts2.f(3)

NAME
sgtts2.f - SYNOPSIS
Functions/Subroutines subroutine sgtts2 (ITRANS, N, NRHS, DL, D, DU, DU2, IPIV, B, LDB) SGTTS2 Function/Subroutine Documentation subroutine sgtts2 (integerITRANS, integerN, integerNRHS, real, dimension( * )DL, real, dimension( * )D, real, dimension( * )DU, real, dimension( * )DU2, integer, dimension( * )IPIV, real, dimension( ldb, * )B, integerLDB) SGTTS2 Purpose: SGTTS2 solves one of the systems of equations A*X = B or A**T*X = B, with a tridiagonal matrix A using the LU factorization computed by SGTTRF. Parameters: ITRANS ITRANS is INTEGER Specifies the form of the system of equations. = 0: A * X = B (No transpose) = 1: A**T* X = B (Transpose) = 2: A**T* X = B (Conjugate transpose = Transpose) N N is INTEGER The order of the matrix A. NRHS NRHS is INTEGER The number of right hand sides, i.e., the number of columns of the matrix B. NRHS >= 0. DL DL is REAL array, dimension (N-1) The (n-1) multipliers that define the matrix L from the LU factorization of A. D D is REAL array, dimension (N) The n diagonal elements of the upper triangular matrix U from the LU factorization of A. DU DU is REAL array, dimension (N-1) The (n-1) elements of the first super-diagonal of U. DU2 DU2 is REAL array, dimension (N-2) The (n-2) elements of the second super-diagonal of U. IPIV IPIV is INTEGER array, dimension (N) The pivot indices; for 1 <= i <= n, row i of the matrix was interchanged with row IPIV(i). IPIV(i) will always be either i or i+1; IPIV(i) = i indicates a row interchange was not required. B B is REAL array, dimension (LDB,NRHS) On entry, the matrix of right hand side vectors B. On exit, B is overwritten by the solution vectors X. LDB LDB is INTEGER The leading dimension of the array B. LDB >= max(1,N). Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Definition at line 129 of file sgtts2.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 sgtts2.f(3)
All times are GMT -4. The time now is 11:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy