Sponsored Content
Top Forums UNIX for Dummies Questions & Answers converting a tabular format data to comma seperated data in KSH Post 302205677 by Hemamalini on Monday 16th of June 2008 04:37:15 AM
Old 06-16-2008
Hi Don,

I tried the same its just substituting the one comma for each space.
the space in between the columns are of variable length so could you please help me.

The data in table format will be something like this

User ID Eid T Profile S E
---------- ----------- - -------------------------------------------------- - -
234 1 U Data Administration A
123 2 U M A
and the header gets repeated for every 10 records.
could you please help me n removing the header records in between other than the first line also pls.

Thanks,
Hema.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert the result of the select query to comma seperated data - urgent pls

how to convert the result of the select query to comma seperated data and put in a .csv file using korn shell. Pls help me as its very urgent. Thanks, Hema. (1 Reply)
Discussion started by: Hemamalini
1 Replies

2. Shell Programming and Scripting

Removing blank lines from comma seperated and space seperated file.

Hi, I want to remove empty/blank lines from comma seperated and space seperated files Thanks all for help (11 Replies)
Discussion started by: pinnacle
11 Replies

3. Shell Programming and Scripting

[SOLVED] Converting data from one format to the other

Hi All, I need to convert an exel spreadsheet into a SAS dataset, and the following format change is needed. Please help, this is too complex for a biologist. Let me describe the input. 1st row is generation.1st column in keyword 'generation', starting 2nd column there are 5... (9 Replies)
Discussion started by: newbie83
9 Replies

4. Shell Programming and Scripting

Generate tabular data based on a column value from an existing data file

Hi, I have a data file with : 01/28/2012,1,1,98995 01/28/2012,1,2,7195 01/29/2012,1,1,98995 01/29/2012,1,2,7195 01/30/2012,1,1,98896 01/30/2012,1,2,7083 01/31/2012,1,1,98896 01/31/2012,1,2,7083 02/01/2012,1,1,98896 02/01/2012,1,2,7083 02/02/2012,1,1,98899 02/02/2012,1,2,7083 I... (1 Reply)
Discussion started by: himanish
1 Replies

5. Shell Programming and Scripting

Extract data in tabular format from multiple files

Hi, I have directory with multiple files from which i need to extract portion of specif lines and insert it in a new file, the new file will contain a separate columns for each file data. Example: I need to extract Value_1 & Value_3 from all files and insert in output file as below: ... (2 Replies)
Discussion started by: belalr
2 Replies

6. Shell Programming and Scripting

Convert data to a tabular format

How can i convert the below data to a simpler format :- cat tabular.txt User 1 Details :- First Name = Tom Middle Name = Last Name = Hanks Age = 40 Address = User 2 details :- First Name = Mike Middle Name = Last Name = Tyson Age = 50 Address = (2 Replies)
Discussion started by: lazydev
2 Replies

7. Shell Programming and Scripting

Converting text files to xls through awk script for specific data format

Dear Friends, I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls. The input is as follows: >gi|1234|ref| Query = 1 - 65, Target = 1677 - 1733 Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46 fd sdfsdfsdfsdf fsdfdsfdfdfdfdfdf... (6 Replies)
Discussion started by: Amit1
6 Replies

8. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

9. Programming

Visual Basic converting a decimal data type to a label with currency format

Here is the code that I am working with. I have tried several other things. any suggestions? Lbl_Cost_Output.Text = (dDistance * dCostPerMile).ToString("C") The label is formatted correctly in terms of value 0.00 but no dollar sign appears. Please let me know if you have any questions. (1 Reply)
Discussion started by: briandanielz
1 Replies

10. Shell Programming and Scripting

Convert listner.log to csv format with comma seperated

Hi All, I am new to shell scripting i am trying to convert the listner.log to csv which can be inturn converted to excel for easy reading. i used this command awk '/SID=/ && /HOST=/ && /PORT=/ && /USER=/ { i=match($0,"SID="); i=i+RLENGTH; h0=substr($0,i); i=match(h0,")");... (6 Replies)
Discussion started by: skoshekay
6 Replies
DBI::ProfileData(3pm)					User Contributed Perl Documentation				     DBI::ProfileData(3pm)

NAME
DBI::ProfileData - manipulate DBI::ProfileDumper data dumps SYNOPSIS
The easiest way to use this module is through the dbiprof frontend (see dbiprof for details): dbiprof --number 15 --sort count This module can also be used to roll your own profile analysis: # load data from dbi.prof $prof = DBI::ProfileData->new(File => "dbi.prof"); # get a count of the records (unique paths) in the data set $count = $prof->count(); # sort by longest overall time $prof->sort(field => "longest"); # sort by longest overall time, least to greatest $prof->sort(field => "longest", reverse => 1); # exclude records with key2 eq 'disconnect' $prof->exclude(key2 => 'disconnect'); # exclude records with key1 matching /^UPDATE/i $prof->exclude(key1 => qr/^UPDATE/i); # remove all records except those where key1 matches /^SELECT/i $prof->match(key1 => qr/^SELECT/i); # produce a formatted report with the given number of items $report = $prof->report(number => 10); # clone the profile data set $clone = $prof->clone(); # get access to hash of header values $header = $prof->header(); # get access to sorted array of nodes $nodes = $prof->nodes(); # format a single node in the same style as report() $text = $prof->format($nodes->[0]); # get access to Data hash in DBI::Profile format $Data = $prof->Data(); DESCRIPTION
This module offers the ability to read, manipulate and format DBI::ProfileDumper profile data. Conceptually, a profile consists of a series of records, or nodes, each of each has a set of statistics and set of keys. Each record must have a unique set of keys, but there is no requirement that every record have the same number of keys. METHODS
The following methods are supported by DBI::ProfileData objects. $prof = DBI::ProfileData->new(File => "dbi.prof") $prof = DBI::ProfileData->new(File => "dbi.prof", Filter => sub { ... }) $prof = DBI::ProfileData->new(Files => [ "dbi.prof.1", "dbi.prof.2" ]) Creates a a new DBI::ProfileData object. Takes either a single file through the File option or a list of Files in an array ref. If multiple files are specified then the header data from the first file is used. Files Reference to an array of file names to read. File Name of file to read. Takes precedence over "Files". DeleteFiles If true, the files are deleted after being read. Actually the files are renamed with a C.deleteme> suffix before being read, and then, after reading all the files, they're all deleted together. The files are locked while being read which, combined with the rename, makes it safe to 'consume' files that are still being generated by DBI::ProfileDumper. Filter The "Filter" parameter can be used to supply a code reference that can manipulate the profile data as it is being read. This is most useful for editing SQL statements so that slightly different statements in the raw data will be merged and aggregated in the loaded data. For example: Filter => sub { my ($path_ref, $data_ref) = @_; s/foo = '.*?'/foo = '...'/ for @$path_ref; } Here's an example that performs some normalization on the SQL. It converts all numbers to "N" and all quoted strings to "S". It can also convert digits to N within names. Finally, it summarizes long "IN (...)" clauses. It's aggressive and simplistic, but it's often sufficient, and serves as an example that you can tailor to suit your own needs: Filter => sub { my ($path_ref, $data_ref) = @_; local $_ = $path_ref->[0]; # whichever element contains the SQL Statement s/d+/N/g; # 42 -> N s/0x[0-9A-Fa-f]+/N/g; # 0xFE -> N s/'.*?'/'S'/g; # single quoted strings (doesn't handle escapes) s/".*?"/"S"/g; # double quoted strings (doesn't handle escapes) # convert names like log_20001231 into log_NNNNNNNN, controlled by $opt{n} s/([a-z_]+)(d{$opt{n},})/$1.('N' x length($2))/ieg if $opt{n}; # abbreviate massive "in (...)" statements and similar s!(([NS],){100,})!sprintf("$2,{repeated %d times}",length($1)/2)!eg; } It's often better to perform this kinds of normalization in the DBI while the data is being collected, to avoid too much memory being used by storing profile data for many different SQL statement. See DBI::Profile. $copy = $prof->clone(); Clone a profile data set creating a new object. $header = $prof->header(); Returns a reference to a hash of header values. These are the key value pairs included in the header section of the DBI::ProfileDumper data format. For example: $header = { Path => [ '!Statement', '!MethodName' ], Program => 't/42profile_data.t', }; Note that modifying this hash will modify the header data stored inside the profile object. $nodes = $prof->nodes() Returns a reference the sorted nodes array. Each element in the array is a single record in the data set. The first seven elements are the same as the elements provided by DBI::Profile. After that each key is in a separate element. For example: $nodes = [ [ 2, # 0, count 0.0312958955764771, # 1, total duration 0.000490069389343262, # 2, first duration 0.000176072120666504, # 3, shortest duration 0.00140702724456787, # 4, longest duration 1023115819.83019, # 5, time of first event 1023115819.86576, # 6, time of last event 'SELECT foo FROM bar' # 7, key1 'execute' # 8, key2 # 6+N, keyN ], # ... ]; Note that modifying this array will modify the node data stored inside the profile object. $count = $prof->count() Returns the number of items in the profile data set. $prof->sort(field => "field") $prof->sort(field => "field", reverse => 1) Sorts data by the given field. Available fields are: longest total count shortest The default sort is greatest to smallest, which is the opposite of the normal Perl meaning. This, however, matches the expected behavior of the dbiprof frontend. $count = $prof->exclude(key2 => "disconnect") $count = $prof->exclude(key2 => "disconnect", case_sensitive => 1) $count = $prof->exclude(key1 => qr/^SELECT/i) Removes records from the data set that match the given string or regular expression. This method modifies the data in a permanent fashion - use clone() first to maintain the original data after exclude(). Returns the number of nodes left in the profile data set. $count = $prof->match(key2 => "disconnect") $count = $prof->match(key2 => "disconnect", case_sensitive => 1) $count = $prof->match(key1 => qr/^SELECT/i) Removes records from the data set that do not match the given string or regular expression. This method modifies the data in a permanent fashion - use clone() first to maintain the original data after match(). Returns the number of nodes left in the profile data set. $Data = $prof->Data() Returns the same Data hash structure as seen in DBI::Profile. This structure is not sorted. The nodes() structure probably makes more sense for most analysis. $text = $prof->format($nodes->[0]) Formats a single node into a human-readable block of text. $text = $prof->report(number => 10) Produces a report with the given number of items. AUTHOR
Sam Tregar <sam@tregar.com> COPYRIGHT AND LICENSE
Copyright (C) 2002 Sam Tregar This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself. perl v5.14.2 2007-09-27 DBI::ProfileData(3pm)
All times are GMT -4. The time now is 08:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy