Sponsored Content
Top Forums Shell Programming and Scripting Convert column values into row Post 302393479 by appu2176 on Tuesday 9th of February 2010 01:45:47 AM
Old 02-09-2010
For multiple columns

Hi All,

good morning.

I have an output file out of a native database in the following format..
Code:
term_id = "ABCDEF"
post_dat = "20090905"
hpr1_amt_beg = 30090000

term_id = "ade"
post_dat = "20090904"
hpr1_amt_beg = 3009123
 
term_id = "DEF"
post_dat = "20090903"
hpr1_amt_beg = 30090030

and i need it to be printed in the following format...
Code:
 
term_id post_dat hpr1_amt_beg
ABCDEF 20090905 30090000 
ADE    20090904 30090030
DEF    20090903 30090030

I tried using awk & sed...but somehow the output format is not exactly coming as above.Can somebody help me out here...Thanks mates.

Last edited by Scott; 02-09-2010 at 03:15 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

convert column into row with some modifier

A file content have 1 1:-0.289433 2:0.833778 3:0.314471 4:-0.289433 5:-0.81876 6:-0.456693 7:-0.17511 8:-0.644555 9:-0.00666341 10:-1.13603 I will like to have that column into row with numbers to be printed (red color) only after colon output shud be like that -0.289433... (1 Reply)
Discussion started by: cdfd123
1 Replies

2. Shell Programming and Scripting

column to row convert - script - help

Hi, I have a file named col.txt 1.000 2.000 3.000 4.000 5.000 6.000 7.000 8.000 I should get this 1.000 5.000 2.000 6.000 3.000 7.000 (10 Replies)
Discussion started by: G0Y
10 Replies

3. Shell Programming and Scripting

convert a column to row output?

Getting tired of cut-and-paste...so I thought I would post a question. how do I change this column output to a single row? from this: # vgdisplay -v /dev/vgeva05 | grep dsk | awk '{print $3}' /dev/dsk/c6t0d5 /dev/dsk/c11t0d5 /dev/dsk/c15t0d5 /dev/dsk/c18t0d5 /dev/dsk/c7t0d5... (8 Replies)
Discussion started by: mr_manny
8 Replies

4. Shell Programming and Scripting

Convert row to column

Hi, I have a file like this 50 1 2 1374438 50 1 2 1682957 50 5 2 1453574 50 10 2 1985890 100 1 2 737307 100 5 2 1660204 100 10 2 2148483 and I want to convert this by... (1 Reply)
Discussion started by: gvj
1 Replies

5. Shell Programming and Scripting

convert row to column with respect of first column.

Input file A.txt :- C2062 -117.6 -118.5 -117.5 C5145 0 0 0 C5696 0 0 0 Output file B.txt C2062 X -117.6 C2062 Y -118.5 C2062 Z -117.5... (4 Replies)
Discussion started by: asavaliya
4 Replies

6. Shell Programming and Scripting

Script: Convert row in to column

Hi, i need to convert SG_ERP1 SG_ERP2 SG_ERP3 in to: SG_ERP1 SG_ERP2 SG_ERP3 It's possibile? (16 Replies)
Discussion started by: elilmal
16 Replies

7. Shell Programming and Scripting

Print every 5 4th column values as separate row with different first column

Hi, I have the following file, chr1 100 200 20 chr1 201 300 22 chr1 220 345 23 chr1 230 456 33.5 chr1 243 567 90 chr1 345 600 20 chr1 430 619 21.78 chr1 870 910 112.3 chr1 914 920 12 chr1 930 999 13 My output would be peak1 20 22 23 33.5 90 peak2 20 21.78 112.3 12 13 Here the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

8. Shell Programming and Scripting

How to convert the row to column in Perl?

Dear Perl users, Could you help me how to convert from row to column if I've a case below: Linux 2014_01_24 CPU 10 Linux 2014_01_24 MEM 20 UNIX 2014_01_24 CPU 30 UNIX 2014_01_24 MEM ... (6 Replies)
Discussion started by: askari
6 Replies

9. Shell Programming and Scripting

[Solved] Convert Row To column

Hi Folks, I am using db2 command -> db2 list tablespace show detail Tablespace ID = 10 Name = TSCDDHLMSUM Type = Database managed space Contents = All permanent data.... (5 Replies)
Discussion started by: ckwan
5 Replies

10. 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
RRDGRAPH_DATA(1)						      rrdtool							  RRDGRAPH_DATA(1)

NAME
rrdgraph_data - preparing data for graphing in rrdtool graph SYNOPSIS
DEF:<vname>=<rrdfile>:<ds-name>:<CF>[:step=<step>][:start=<time>][:end=<time>][:reduce=<CF>] VDEF:vname=RPN expression CDEF:vname=RPN expression DESCRIPTION
These three instructions extract data values out of the RRD files, optionally altering them (think, for example, of a bytes to bits conversion). If so desired, you can also define variables containing useful information such as maximum, minimum etcetera. Two of the instructions use a language called RPN which is described in its own manual page. Variable names (vname) must be made up strings of the following characters "A-Z, a-z, 0-9, -,_" and a maximum length of 255 characters. When picking variable names, make sure you do not choose a name that is already taken by an RPN operator. A safe bet it to use lowercase or mixed case names for variables since operators will always be in uppercase. DEF
DEF:<vname>=<rrdfile>:<ds-name>:<CF>[:step=<step>][:start=<time>][:end=<time>][:reduce=<CF>] This command fetches data from an RRD file. The virtual name vname can then be used throughout the rest of the script. By default, an RRA which contains the correct consolidated data at an appropriate resolution will be chosen. The resolution can be overridden with the --step option. The resolution can again be overridden by specifying the step size. The time span of this data is the same as for the graph by default, you can override this by specifying start and end. Remember to escape colons in the time specification! If the resolution of the data is higher than the resolution of the graph, the data will be further consolidated. This may result in a graph that spans slightly more time than requested. Ideally each point in the graph should correspond with one CDP from an RRA. For instance, if your RRD has an RRA with a resolution of 1800 seconds per CDP, you should create an image with width 400 and time span 400*1800 seconds (use appropriate start and end times, such as "--start end-8days8hours"). If consolidation needs to be done, the CF of the RRA specified in the DEF itself will be used to reduce the data density. This behavior can be changed using ":reduce=<CF>". This optional parameter specifies the CF to use during the data reduction phase. Example: DEF:ds0=router.rrd:ds0:AVERAGE DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200 DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end-1h DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11:00:end=start+1h VDEF
VDEF:vname=RPN expression This command returns a value and/or a time according to the RPN statements used. The resulting vname will, depending on the functions used, have a value and a time component. When you use this vname in another RPN expression, you are effectively inserting its value just as if you had put a number at that place. The variable can also be used in the various graph and print elements. Example: "VDEF:avg=mydata,AVERAGE" Note that currently only aggregation functions work in VDEF rpn expressions. Patches to change this are welcome. CDEF
CDEF:vname=RPN expression This command creates a new set of data points (in memory only, not in the RRD file) out of one or more other data series. The RPN instructions are used to evaluate a mathematical function on each data point. The resulting vname can then be used further on in the script, just as if it were generated by a DEF instruction. Example: "CDEF:mydatabits=mydata,8,*" About CDEF versus VDEF At some point in processing, RRDtool has gathered an array of rates ready to display. CDEF works on such an array. For example, CDEF:new=ds0,8,* would multiply each of the array members by eight (probably transforming bytes into bits). The result is an array containing the new values. VDEF also works on such an array but in a different way. For example, VDEF:max=ds0,MAXIMUM would scan each of the array members and store the maximum value. When do you use VDEF versus CDEF? Use CDEF to transform your data prior to graphing. In the above example, we'd use a CDEF to transform bytes to bits before graphing the bits. You use a VDEF if you want max(1,5,3,2,4) to return five which would be displayed in the graph's legend (to answer, what was the maximum value during the graph period). If you want to apply 'complex' operations to the result of a VDEF you have to use a CDEF again since VDEFs only look like RPN expressions, they aren't really. SEE ALSO
rrdgraph gives an overview of how rrdtool graph works. rrdgraph_data describes DEF,CDEF and VDEF in detail. rrdgraph_rpn describes the RPN language used in the ?DEF statements. rrdgraph_graph page describes all of the graph and print functions. Make sure to read rrdgraph_examples for tips&tricks. AUTHOR
Program by Tobias Oetiker <tobi@oetiker.ch> This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with corrections and/or additions by several people 1.4.8 2013-05-23 RRDGRAPH_DATA(1)
All times are GMT -4. The time now is 04:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy