Sponsored Content
Top Forums Shell Programming and Scripting Help to Create this file format structure Post 302187817 by enigma_83 on Tuesday 22nd of April 2008 04:08:41 AM
Old 04-22-2008
Help to Create this file format structure

This data comes form the table and exported into the file in this format

File1 Format
weboffercode1,sourcecode1,1,1,1,1,1,1

weboffercode1,sourcecode2,1,1,1,1,1,1

weboffercode1,sourcecode1,1,1,1,1,1,1

weboffercode1,sourcecode3,1,1,1,1,1,1

weboffercode1,sourcecode3,1,1,1,1,1,1

weboffercode2,sourcecode1,1,1,1,1,1,1

weboffercode2,sourcecode1,1,1,1,1,1,1

weboffercode2,sourcecode2,1,1,1,1,1,1

weboffercode3,sourcecode1,1,1,1,1,1,1

weboffercode3,sourcecode2,1,1,1,1,1,1

I have to format this file in the following format as :-

File2 :
sum of the field f3,f4,f5,f6,f7,f8 for same WebOfferCode and Source code combination

weboffercode1,sourcecode1,2,2,2,2,2,2

weboffercode1,sourcecode2,1,1,1,1,1,1

weboffercode1,sourcecode3,2,2,2,2,2,2

sum of fields f3,f4,f5,f6,f7,f8 for same WebOfferCode

TOTAL, weboffercode1,5,5,5,5,5,5

sum of the field f3,f4,f5,f6,f7,f8 for same WebOfferCode and Source code combination

weboffercode2,sourcecode1,2,2,2,2,2,2

weboffercode2,sourcecode2,1,1,1,1,1,1

sum of fields f3,f4,f5,f6,f7,f8 for same WebOfferCode

TOTAL, weboffercode1,3,3,3,3,3,3

sum of the field f3,f4,f5,f6,f7,f8 for same WebOfferCode and Source code combination

weboffercode3,sourcecode1,1,1,1,1,1,1

weboffercode3,sourcecode2,1,1,1,1,1,1

sum of fields f3,f4,f5,f6,f7,f8 for same WebOfferCode
TOTAL, weboffercode2,2,2,2,2,2,2

So that if I save this file2.csv it is in the format of the picture as shown above.Let me know how can I do the operations on File1 to create such file format as File2...Primarily I was to know how to write a script to add the data present in the file column wise.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to create concatenate a file in tab format

Hi, Do you know given a file which is SED at the same time, how to read it and AWK it in tabs format. Means:- I have an input file which is (at the same time perform sed):- 1 2 3 4 5 6 7 I would like to print out in tab format which is:- 1 2 3 4 5 6 7 .... (12 Replies)
Discussion started by: ahjiefreak
12 Replies

2. Shell Programming and Scripting

How to create a directory structure with getting input from a file.

Hi How to create a directory structure with getting input from a file. I have file in that following lines are written. ./activemq-4.1.2/activemq-core-4.1.2.jar ./activemq-4.1.2/backport-util-concurrent-2.1.jar ./camel-1.4.0/apache-camel-1.4.0.jar ./camel-1.4.0/lib/activation-1.1.jar... (12 Replies)
Discussion started by: itsjoy2u
12 Replies

3. Shell Programming and Scripting

How to format or create a matrix report from file

Dear Unix champs, I have a input file as attached, i would like to create an report from the file as below FileType | EQUENS0001 | EQUENS0002 | EQUENS1100 | EQUENS0003 --------+-------------------------------------------------------- Msg No |... (3 Replies)
Discussion started by: manas_ranjan
3 Replies

4. UNIX for Advanced & Expert Users

to create format file for bcp in

I want to create the format file for bcp in a file to the table. My Versions are: Unix: Sun OS, DB: Sybase. How can i create the format file. Is there any way to create the format by bcp command or some system sp. Please help. (3 Replies)
Discussion started by: Arunprasad
3 Replies

5. Shell Programming and Scripting

How to create a C structure using table description.

There is table 'DEPT' in the database with the following desciption: Name Null? Type ------- -------- ------------------------ DEPTNO NOT NULL NUMBER(2) DNAME NULL VARCHAR2(14) LOC NULL VARCHAR2(13) Using shell script, I need to create a structure for the... (2 Replies)
Discussion started by: ehari
2 Replies

6. Shell Programming and Scripting

How we can create the master file through shell to show the tree structure of the directory?

Can we create the master file that show the whole tree structure of the directory till a particular folder? Database that contains four sub repository Sybase,sql,oracle,mysql and sql and oracle contains two subrepostories Siebel and plsql and each repositories contains three folders... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

7. Shell Programming and Scripting

Create Directory structure

Hello ; ) again Now I have my file like this : DIR2/DIR3 DIR2 DIR2/DIR3/DIR4/DIR5 I am looking for help to create a loop that will create the directory structure. I need something like this : If "DIR2" does not exist > Create IF "DIR2" exist already > check if onther "DIR"... (5 Replies)
Discussion started by: Aswex
5 Replies

8. Shell Programming and Scripting

Needed touch command to create a file in the following format

needed touch command to create a file in the following format touch a_yyyymmdd_hhmmss (1 Reply)
Discussion started by: hemanthsaikumar
1 Replies

9. Shell Programming and Scripting

Create a flat file and directory structure

Hi All, is there any work around to generate the file and directory structure like below at left side at Output? and exclude all file except .abc .txt Current Directory structure |-------------files |---------------Share |-----------------dir1 |-----------------dir2... (11 Replies)
Discussion started by: heros
11 Replies

10. UNIX for Beginners Questions & Answers

Create movie from jpg (or other picture format) file

hi linux expert is there any program for create movie file from pictures file (like jpg)? Many Thanks samad (1 Reply)
Discussion started by: abdossamad2003
1 Replies
Data::Format::HTML(3pm) 				User Contributed Perl Documentation				   Data::Format::HTML(3pm)

NAME
Data::Format::HTML - Format Perl data structures into simple HTML SYNOPSIS
use Data::Format::HTML; my $f = Data::Format::HTML->new; my %hash = (simple => 'hash'); # Of course it's very unlikely that you won't deal ever with this # kind of structure, but HTML is able to hand it all anyway :) my $struct = { foo => 'bar', 1 => 2, 'hello' => 'goodbye', array_ref => [qw/one two three/], nested_hash => \%hash, [qw/1 2/] => sub { die; }, even_more => { arr => { 1 => [2, 3, 4], this_is_insane => { a => { b => { c => { d => { e => 'z'}}}}} }, }, }; $struct->{'Data::Format::HTML handles it all'} = $f; print $f->format(); And that will output the following insane, but possible, for the sake of showing, HTML: In theory you can pass any kind of Perl data structure to "format" and you will get its data HTML-formatted. TODO
o A LOT. ;) o Explain how CSS can prettify the tables (specification for everything) o Get CSS. o Better support for GLOB, CODE, REF and company. o Extend this documentation. SEE MORE
The author keeps the versioned code at GitHub at: http://github.com/damog/data-format-html/tree/master <http://github.com/damog/data- format-html/tree/master>. AUTHOR
David Moreno Garza, <david@axiombox.com> - <http://damog.net/> THANKS
To Raquel (<http://www.maggit.com.mx/>), who makes me happy every single day of my life. COPYRIGHT AND LICENSE
Copyright (C) 2008 by David Moreno Garza This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. The Do What The Fuck You Want To public license also applies. It's really up to you. perl v5.12.3 2009-07-17 Data::Format::HTML(3pm)
All times are GMT -4. The time now is 04:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy