Sponsored Content
Full Discussion: Column to row Transpose
Top Forums Shell Programming and Scripting Column to row Transpose Post 302796541 by tech_frk on Friday 19th of April 2013 05:13:04 PM
Old 04-19-2013
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

HTML Code:
Charlie chicago 15
Charlie newyork 26
jonny chicago 14
jonny newyork 15
joe chicago 15
joe newyork 18
output should be

Code:
Name chicago   newyork       
Charlie   15   26
jonny   14   15
joe   15   18

Output is row to column transpose,chicago & newyork are fixed cities, Person name varies and both cities will be contiguos, if only 1 value per say that is only chicago is there then the value for newyork should be "N/A" in the resulting output.Apreciate your help.

Thank you.
 

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

Transpose column to row

Hi i have a file which has values seperated by "," as shown below and I want to transpose for every doc_id in one row. Input: DOC_ID,KEYWORD 105,REGISTROS 105,GEOLOGIA 105,NUCLEOS 105,EXPEDIENTE 105,PROGRAMAS 10025,EXPEDIENTE 10025,LOCALIZACIONES 10025,OFICIOS 10025,PROGRAMAS... (4 Replies)
Discussion started by: juelillo
4 Replies

3. 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

4. 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

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
HTML::Tree(3)						User Contributed Perl Documentation					     HTML::Tree(3)

NAME
HTML::Tree - overview of HTML::TreeBuilder et al VERSION
3.23 SYNOPSIS
use HTML::TreeBuilder; my $tree = HTML::TreeBuilder->new(); $tree->parse_file($filename); # Then do something with the tree, using HTML::Element # methods -- for example: $tree->dump # Finally: $tree->delete; DESCRIPTION
HTML-Tree is a suite of Perl modules for making parse trees out of HTML source. It consists of mainly two modules, whose documentation you should refer to: HTML::TreeBuilder and HTML::Element. HTML::TreeBuilder is the module that builds the parse trees. (It uses HTML::Parser to do the work of breaking the HTML up into tokens.) The tree that TreeBuilder builds for you is made up of objects of the class HTML::Element. If you find that you do not properly understand the documentation for HTML::TreeBuilder and HTML::Element, it may be because you are unfamiliar with tree-shaped data structures, or with object-oriented modules in general. Sean Burke has written some articles for The Perl Journal ("www.tpj.com") that seek to provide that background. The full text of those articles is contained in this distribution, as: HTML::Tree::AboutObjects "User's View of Object-Oriented Modules" from TPJ17. HTML::Tree::AboutTrees "Trees" from TPJ18 HTML::Tree::Scanning "Scanning HTML" from TPJ19 Readers already familiar with object-oriented modules and tree-shaped data structures should read just the last article. Readers without that background should read the first, then the second, and then the third. SUPPORT
You can find documentation for this module with the perldoc command. perldoc HTML::Tree You can also look for information at: o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/HTML-Tree <http://annocpan.org/dist/HTML-Tree> o CPAN Ratings http://cpanratings.perl.org/d/HTML-Tree <http://cpanratings.perl.org/d/HTML-Tree> o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Tree <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Tree> o Search CPAN http://search.cpan.org/dist/HTML-Tree <http://search.cpan.org/dist/HTML-Tree> SEE ALSO
HTML::TreeBuilder, HTML::Element, HTML::Tagset, HTML::Parser, HTML::DOMbo The book Perl & LWP by Sean M. Burke published by O'Reilly and Associates, 2002. ISBN: 0-596-00178-9 It has several chapters to do with HTML processing in general, and HTML-Tree specifically. There's more info at: http://www.oreilly.com/catalog/perllwp/ http://www.amazon.com/exec/obidos/ASIN/0596001789 SOURCE REPOSITORY
HTML::Tree is maintained in Subversion hosted at perl.org. http://svn.perl.org/modules/HTML-Tree The latest development work is always at: http://svn.perl.org/modules/HTML-Tree/trunk Any patches sent should be diffed against this repository. ACKNOWLEDGEMENTS
Thanks to Gisle Aas, Sean Burke and Andy Lester for their original work. Thanks to Chicago Perl Mongers (http://chicago.pm.org) for their patches submitted to HTML::Tree as part of the Phalanx project (http://qa.perl.org/phalanx). Thanks to the following people for additional patches and documentation: Terrence Brannon, Gordon Lack, Chris Madsen and Ricardo Signes. AUTHOR
Original HTML-Tree author Gisle Aas. Handed off to Sean M. Burke. and Andy Lester. Currently maintained by Pete Krawczyk "<petek@cpan.org>". COPYRIGHT
Copyright 1995-1998 Gisle Aas; 1999-2004 Sean M. Burke; 2005 Andy Lester; 2006 Pete Krawczyk. (Except the articles contained in HTML::Tree::AboutObjects, HTML::Tree::AboutTrees, and HTML::Tree::Scanning, which are all copyright 2000 The Perl Journal.) Except for those three TPJ articles, the whole HTML-Tree distribution, of which this file is a part, is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Those three TPJ articles may be distributed under the same terms as Perl itself. The programs in this library are distributed in the hope that they will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. perl v5.12.1 2006-11-12 HTML::Tree(3)
All times are GMT -4. The time now is 11:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy