Sponsored Content
Top Forums Shell Programming and Scripting Help for a Perl newcomer! Transposing data from columns to rows Post 302578058 by Sarah_W on Wednesday 30th of November 2011 04:08:36 PM
Old 11-30-2011
Sorry I was a bit quick to say it doesn't work, having a play around on excel i have managed to allign the collumns and the items at the top are specified perfectly by the condition, which is what I needed.

However, it has rearranged the the data, so the subject numbers are now randomally arranged rather than being subject 1,2,3 etc. Likewise the items at the top are arranged in a alphabetical order, not the order how they originally were. consequently it appears that the corresponding number data within the table does not match the relevent condition and item.

I have cross checked a few of the conditions and items to what the number in the table should be and they do not match.

Also in the row where the item and condition is specified along the top, it is fine apart from there is a random insertion of the the condition collum and obviously that does not need to be there. it looks like this....

CPz_Li..ncePurNeutRem ConditionsMixNegForg ConditionsMixNegRem ConditionsMixNeutFor ConditionsMixNeutRem 7.906 2.634 -0.53 1.226 14.77
obvioulsy, i do not need the 'conditions' listed like that in the top row, as that is what the MixNegRem etc... are already doing along side the items!

Hope all this makes sense!

Thanks again

---------- Post updated at 09:08 PM ---------- Previous update was at 08:53 PM ----------

Weirdly however, I have just ran it on only subject 1's data and it works perfectly!
all the conditions are with the items as they should be along the top and there is no intrusion of a 'condition' item along the top.
Again though the items at the top are in alphabetical order, is there any way to keep them in the original format?
Crucially the data in the table matches the conditions, so it may just mean that I have to run the script on each subject individually and merge the data into excell by hand.

I think when I try to run it on the large data set, the collumn called 'Condition' may be the confusing factor.

If you can think of anything to make it work on the large data set that would be fantastic, but if not I may have to just result to doing it by hand.

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rows to columns transposing and reformating.

----File attached. Input file =========== COL_1 <IP Add 1> COL_2 <Service1> COL_3 <ABCDEFG> COL_4 <IP ADD:PORT> COL_4 <IP ADD:PORT> COL_1 <IP Add 2> COL_2 <Service2> COL_2 <Service3> COL_2 <Service4> COL_3 <AAAABBB> COL_4 <IP ADD:PORT> COL_4 <IP ADD:PORT> COL_4 <IP... (27 Replies)
Discussion started by: bluethunder
27 Replies

2. Shell Programming and Scripting

Data in Rows to Columns

Hi, I am a beginner in bash&perl. I have data in form of:- A 1 B 2 C 3 D 4 E 5 I would like your help to find a simple way to change it to :- A B C D E 1 2 3 4 5 Any help would be highly appreciated. (8 Replies)
Discussion started by: umaars
8 Replies

3. Shell Programming and Scripting

Transposing rows into columns

I have a file like the one given below P1|V1|V2 P1|V1|V3 P1V1|V2 P2|V1|V4 P2|V2|V6 P2|V1|V4 I want it convert to P1|V1|V2|V2|V3 P2|V1|V4|V2|V6 2nd and 3rd column should be considered as together and so the tird row is duplicate Any ideas? (3 Replies)
Discussion started by: prasperl
3 Replies

4. UNIX for Dummies Questions & Answers

Suggestion to convert data in rows to data in columns

Hello everyone! I have a huge dataset looking like this: nameX nameX 0 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ............... nameY nameY 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ..... nameB nameB 0 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ..... (can be several thousands of codes) and I need... (8 Replies)
Discussion started by: kush
8 Replies

5. Shell Programming and Scripting

awk, string as record separator, transposing rows into columns

I'm working on a different stage of a project that someone helped me address elsewhere in these threads. The .docs I'm cycling through look roughly like this: 1 of 26 DOCUMENTS Copyright 2010 The Age Company Limited All Rights Reserved The Age (Melbourne, Australia) November 27, 2010... (9 Replies)
Discussion started by: spindoctor
9 Replies

6. Shell Programming and Scripting

Transposing Repeated Rows to Columns.

I have 1000s of these rows that I would like to transpose to columns. However I would like the transpose every 3 consecutive rows to columns like below, sorted by column 3 and provide a total for each occurrences. Finally I would like a grand total of column 3. 21|FE|41|0B 50\65\78 15... (2 Replies)
Discussion started by: ravzter
2 Replies

7. Shell Programming and Scripting

Transpose Data from Columns to rows

Hello. very new to shell scripting and would like to know if anyone could help me. I have data thats being pulled into a txt file and currently have to manually transpose the data which is taking a long time to do. here is what the data looks like. Server1 -- Date -- Other -- value... (7 Replies)
Discussion started by: Mikes88
7 Replies

8. Shell Programming and Scripting

transposing columns into rows

Hi, I need to transpose columns of my files into rows and save it as individual files. sample contents of the file below. 0.9120 0.7782 0.6959 0.6904 0.6322 0.8068 0.9082 0.9290 0.7272 0.9870 0.7648 0.8053 0.8300 0.9520 0.8614 0.6734 0.7910 0.6413 0.7126 0.7364 0.8491 0.8868 0.7586 0.8949... (8 Replies)
Discussion started by: ida1215
8 Replies

9. Shell Programming and Scripting

Transposing rows and columns (pivoting) using shell scripting

Here is the contents of an input file. A,1,2,3,4 10,aaa,bbb,ccc,ddd 11,eee,fff,ggg,hhh 12,iii,jjj,lll,mmm 13,nnn,ooo,ppp I wanted the output to be A 10 1 aaa 10 2 bbb 10 3 ccc 10 4 ddd 11 1 eee 11 2 fff 11 3 ggg 11 4 hhh ..... and so on How to do it in ksh... (9 Replies)
Discussion started by: ksatish89
9 Replies

10. Shell Programming and Scripting

Transposing rows to columns with multiple similar lines

Hi, I am trying to transpose rows to columns for thousands of records. The problem is there are records that have the same lines that need to be separated. the input file as below:- ID 1A02_HUMAN AC P01892; O19619; P06338; P10313; P30444; P30445; P30446; P30514; AC Q29680; Q29837;... (2 Replies)
Discussion started by: redse171
2 Replies
menu_item_current(3CURSES)				     Curses Library Functions					menu_item_current(3CURSES)

NAME
menu_item_current, set_current_item, current_item, set_top_row, top_row, item_index - set and get current menus items SYNOPSIS
cc [ flag... ] file... -lmenu -lcurses [ library... ] #include <menu.h> int set_current_item(MENU *menu, ITEM *item); ITEM *current_item(MENU *menu); int set_top_row(MENU *menu, int row); int top_row(MENU *menu); int item_index(ITEM *item); DESCRIPTION
The current item of a menu is the item where the cursor is currently positioned. set_current_item() sets the current item of menu to item. current_item() returns a pointer to the the current item in menu. set_top_row() sets the top row of menu to row. The left-most item on the new top row becomes the current item. top_row() returns the number of the menu row currently displayed at the top of menu. item_index() returns the index to the item in the item pointer array. The value of this index ranges from 0 through N-1, where N is the total number of items connected to the menu. RETURN VALUES
current_item() returns NULL on error. top_row() and index_item() return -1 on error. set_current_item() and set_top_row() return one of the following: E_OK The routine returned successfully. E_SYSTEM_ERROR System error. E_BAD_ARGUMENT An incorrect argument was passed to the routine. E_BAD_STATE The routine was called from an initialization or termination function. E_NOT_CONNECTED No items are connected to the menu. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curses(3CURSES), menus(3CURSES), attributes(5) NOTES
The header <menu.h> automatically includes the headers <eti.h> and <curses.h>. SunOS 5.11 31 Dec 1996 menu_item_current(3CURSES)
All times are GMT -4. The time now is 08:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy