i want to convert these into columns as output is not fixed please tell me how to convert 1st row in to 1st columns likewise,as many rows are there are to be converted into columns
thanks in advance
Moderator's Comments:
Please use [code][/code] tags instead of [quote][/quote] tags for code and samples
Last edited by Scrutinizer; 05-03-2012 at 09:33 AM..
Reason: code tags / spelling
If you use an array, you might achieve what you need. You might need to use some indirect reference, but it would be important to know what your script is written in to advise on code.
Additionally, is your code always comma separated and would a comma ever appear as a value? Is the data set large? If so, then probably an awk rather than shell script would be better.
I hope that someone here can help. I have a few ideas, but before knowing the above, i don't want to leap into it.
Robin
liverpool/Blackburn
UK
Last edited by rbatte1; 05-03-2012 at 09:27 AM..
Reason: Spelling
every row is comma separated and each rows max length is 33 char(33 values)
there will be max 15 rows have be converted into columns, but every time the length of characters in rows and number of rows is variable.
every row is comma separated.
this file contains output of several small scripts,combined into one row with comma
like
like wise
and i didn't get the phrase "need to use some indirect reference" plz elaborate.
You statement of
...would actually generate a comma&space separated file. I presume you mean:-
followed by a plain echo at the end of the process.
Anyway, this indirect phrase I used.
If you are using ksh, then the arrays are limited to being one dimensional, i.e. you can only specify one ordinate. If you could specify two, then this would be easier. The logic would work that if you had arrays A and gave them ordinates x & y in a reference that identified a single value as A[x,y] then we could load the array by using a pair of loops like this (not runnable code)
Then you could write the data out again looping the other way around, such as:-
If your shell does not support two diminsional arrays (such as ksh need to check ksh93) we may have to be more inventive. The indirect variable would be a way of trying to use a variable as a variable name, so you make one of the ordinates part of the variable, so if the 2D array is A you would actually define a set of 1D arrays, A1, A2, A3, A4, ...... for as many values of x as you would have. You could then refer to $A3[5] as being array cell 3,5 as it were. The trick is how to get the array name as a variable. It could get messy.
It depends how one would write something like:-
.... which I'm not sure how to code up.
I'm not sure if this helps, but it may bring further suggestions - and I may learn something too!
thanks for reply,but i am a very beginner in unix.I didnt get what u have exactly advised.
consider one more case
if i will break row i.e.
and convert this into column
and same for next rows. and paste it after this first column.
will this make my task easier.
Hi .. anyone can you help me ?
i need to convert text below into multiple columns
interface; GigabitEthernet0/0/0/0
description; TRUNK_PE-D2-JT2-VPN_Gi0/0/0/0_TO_ME4-A-JKT-JT_4/1/1_1G
mtu 9212
negotiation auto
interface; GigabitEthernet0/0/0/0.11
description; tes
encapsulation;... (1 Reply)
Dear fellows, I need your help.
I'm trying to write a script to convert a single column into multiple rows.
But it need to recognize the beginning of the string and set it to its specific Column number.
Each Line (loop) begins with digit (RANGE).
At this moment it's kind of working, but it... (6 Replies)
I have 2 files,
file01= 7 columns, row unknown (but few)
file02= 7 columns, row unknown (but many)
now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there
e.g.
file 01
James|0|50|25|10|50|30... (1 Reply)
Hi gurus!
Please help me with this one. I have an file with the following contents:
a
b
c
d
e
f
g
h
i
j
I would like to make to transform it to look like this as my output file:
a,b,c
d,e,f (4 Replies)
Hi all,
I need your help on a multiple row entry into different columns. And do the same with all the entries in file.
File example (showing 2 entries only, there are many like these):
>ABC
*
AGA-AUUCUC-CGGUUCAAUCU
|||
UCUAUAACCGCGCCGAGUUAGU
>ABC
*
AGAUAU-GCUGCAGGCUCAAUUG
||||||... (2 Replies)
Hi,
I am trying to fetch some values from db and spooling the output to a file.
when i query the db for the values, i get the values in following format.
PC_1 wf_test1 Test
PC_2 wf_test2 Test
PC_3 wf_test3 Test
But my spool file was created in following format.
PC_1
wf_test1
Test... (20 Replies)
Hi every one;
I have a file with 22 rows and 13 columns which includes floating numbers.
I want to parse the file so that every five columns in the row would be a new record (row). For example, the first line in the old file should be converted into three lines with first two lines contain 5... (6 Replies)
i have single column which is starting with same string(many number of rows)
i have to convert each into a single row.how can i do that?
laknar
std
mes
23
55
laknar
isd
phone no
address
amount
99
I have to convert above like below.
laknar|std|mes|23|55
laknar|isd|phone... (3 Replies)
Hi,
Request To guide me in writing a shell program for the following requirement:
Example:if the Input File contains the follwing data
Input File Data:
80723240029,12,323,443,88,98,7,98,67,87
80723240030,12,56,6,,,3,12,56,6,7,2,3,12,56,6,7,2,3,88,98,7,98,67,87... (5 Replies)