Sponsored Content
Top Forums UNIX for Advanced & Expert Users format csv file using shell script Post 302123690 by raosurya on Tuesday 26th of June 2007 06:09:41 PM
Old 06-26-2007
format csv file using shell script

i have a report.csv file from oracle datavase
In that file data is like this with report heading and date

SALES DAILY REPORT
DATE: 06-26-2007
REPORT NAME: SALES DATA

AA.BB.CCCC.DDDD,BBBBB,06-26-2007,0,BEGIN,END
ZZ.VV.DDDD.XXXXXXX,MMMMMM,06-25-2007,18,BEGIN,END
CC.XX.VVV.QQ,KKKKK,06-24-2007,END,BEGIN
fields are separated with ",".
i want to read this file create new file with new format.

i want
col1 WIDTH should increse 15 positions with spaces right side
col2 WIDTH should increse 10 positions with spaces right side
col3 WIDTH should increse 5 positions with spaces right side
col4 WIDTH should increse 7 positions with spaces right side
col5 WIDTH should increse 7 positions with spaces right side
col6 WIDTH should increse 6 positions with spaces right side
BUT HEADING OF THE REPORT SHOULD NOT BE CHANGED.

I WANT NEW OUTPUT FILE SHOULD BE LIKE THIS
Code:
SALES DAILY REPORT
DATE: 06-26-2007 
REPORT NAME: SALES DATA

AA.BB.CCCC.DDDD          ,BBBBB     ,06-26-2007   ,0   ,BEGIN   ,END
ZZ.VV.DDDD.XXXXXXX        ,MMMMMM     ,06-25-2007,18  ,BEGIN   ,END
CC.XX.VVV.QQ      ,KKKKK    ,06-24-2007       ,15     ,END    ,BEGIN


Thanks for your help
i need answer desparately.
N.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to format a .CSV data

Hi There I needed to write a Unix shell script which will pick up the data from a .CSV file and reformat it as per the requirement and write it to another .CSV file. Currently I am in the proess of Data Import to "Remedy System" (A one kind of incident mangement Application) and this... (8 Replies)
Discussion started by: Uday1982
8 Replies

2. UNIX for Dummies Questions & Answers

Unix script to convert .csv file to.xls format

I have a .csv file in Unix box i need a UNIX script to convert the.csv files to.xls format. Its very urgent please help me. (1 Reply)
Discussion started by: moon_friend
1 Replies

3. UNIX for Dummies Questions & Answers

Option in sql script to include column headers when spooling file to .csv format

Can anyone help me how to include COLUMN HEADER when spooling file to .CSV format through SQL statement. Thanks, Akbar (4 Replies)
Discussion started by: s1a2m3
4 Replies

4. UNIX for Advanced & Expert Users

shell script to format .CSV data

Hi all, I have written a shell script to search a specified directory (e.g. /home/user) for a list of specific words (shown as ${TMPDIR}/wordlist below). The script works well enough, but I was wondering if there was a way to display the line number that the word is found on? Thanks! cat... (1 Reply)
Discussion started by: tmcmurtr
1 Replies

5. Shell Programming and Scripting

Is there any script which convert binary file to CSV format

Dear guys; I have a binary file and I need to convert its data to csv format ...appreciating your help. Best Regards (14 Replies)
Discussion started by: ahmad.diab
14 Replies

6. Programming

awk script to convert a text file into csv format

hi...... thanks for allowing me to start a discussion i am collecting usb usage details of all users and convert it into csv files so that i can export it into some database.. the input text file is as follows:- USB History Dump by nabiy (c)2008 (1) --- Kingston DataTraveler 130 USB... (2 Replies)
Discussion started by: certteam
2 Replies

7. Shell Programming and Scripting

Conversion of below Tabs Tex file into CSV format file : shell script needed

Request if some one could provide me shell script that converts the below "input file" to "CSV format file" given Name Domain Contact Phone Email Location ----------------------- ------------------------------------------------ ------- ----- ---------------------------------... (7 Replies)
Discussion started by: sreenath1037
7 Replies

8. Shell Programming and Scripting

Need perl or shell script to sort vertical lines to horizontal line in csv format

Need perl or shell script to sort vertical lines to horizontal line in csv format My file like below ------------------------- ================================================================================ PATH PINKY1000#I1-1-ZENTA1000-2#I7-1-ASON-SBR-UP-943113845 ... (4 Replies)
Discussion started by: sreedhargouda.h
4 Replies

9. Shell Programming and Scripting

Format CSV file from a shell script

I have a shell script which creates a CSV files. there are 3 fields, field1, field2 and comp. I will generates the values for field1 and field2 and Want to compare both. If field1>filed2 then comp should be success written in green in CSV file, else it should fail in red color. How can I change the... (5 Replies)
Discussion started by: sauravrout
5 Replies

10. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
LaTeX::Table::Types::TypeI(3pm) 			User Contributed Perl Documentation			   LaTeX::Table::Types::TypeI(3pm)

NAME
LaTeX::Table::Types::TypeI - Interface for LaTeX table types. DESCRIPTION
This is the type interface (or Moose role), that all type objects must use. LaTeX::Table delegates the LaTeX code generation to type objects. It stores all information we have in easy to use "TEMPLATE VARIABLES". LaTeX::Table ships with very flexible templates, but it is possible to use the template variables defined here to build custom templates. INTERFACE
"generate_latex_code" TEMPLATE VARIABLES
Most options are accessible here: "CENTER, LEFT, RIGHT" Example: [% IF CENTER %]centering [% END %] "ENVIRONMENT, STAR, POSITION, SIDEWAYS" These options for floating environments are typically used like: [% IF ENVIRONMENT %]egin{[% ENVIRONMENT %][% IF STAR %]*[% END %]}[% IF POSITION %][[% POSITION %]][% END %] ... [% END %] # the tabular environment here ... [% IF ENVIRONMENT %] ... end{[% ENVIRONMENT %][% IF STAR %]*[% END %]}[% END %] "CAPTION_TOP, CAPTION_CMD, SHORTCAPTION, CAPTION, CONTINUED, CONTINUEDMSG" The variables to build the caption command. Note that there is NO template for the "maincaption" option. "CAPTION" already includes this maincaption if specified. "LABEL" The label: [% IF LABEL %]label{[% LABEL %]}[% END %] "TABULAR_ENVIRONMENT, WIDTH, COLDEF" These three options define the tabular environment: egin{[% TABULAR_ENVIRONMENT %]}[% IF WIDTH %]{[% WIDTH %]}[% END %]{[% COLDEF %]} "FONTFAMILY, FONTSIZE" Example: [% IF FONTSIZE %][% FONTSIZE %] [% END %][% IF FONTFAMILY %][% FONTFAMILY %]family [% END %] "TABLEHEADMSG, TABLETAIL, TABLELASTTAIL, XENTRYSTRETCH" For the multi-page tables. "MAXWIDTH, FOOTTABLE" Currently only used by LaTeX::Table::Types::Ctable. In addition, some variables already contain formatted LaTeX code: "HEADER_CODE" The formatted header: oprule multicolumn{2}{c}{Item} & \ cmidrule(r){1-2} Animal & Description & Price \ midrule "DATA_CODE" The formatted data: Gnat & per gram & 13.65 \ & each & 0.01 \ Gnu & stuffed & 92.59 \ Emu & stuffed & 33.33 \ Armadillo & frozen & 8.99 \ ottomrule "RESIZEBOX_BEGIN_CODE, RESIZEBOX_END_CODE" Everything between these two template variables is resized according the "resizebox" option. "EXTRA_ROW_HEIGHT_CODE, DEFINE_COLORS_CODE, RULES_COLOR_GLOBAL_CODE, RULES_WIDTH_GLOBAL_CODE" Specified by the theme. "EXTRA_ROW_HEIGHT_CODE" will contain the corresponding LaTeX extrarowheight command, e.g for '1pt': setlength{extrarowheight}{1pt} Otherwise it will contain the empty string. The other template variables will contain the command specified by the corresponding theme option. Finally, some variables allow access to internal "LaTeX::Table" variables: "LT_NUM_COLUMNS" Contains the number of columns of the table. "LT_BOTTOM_RULE_CODE" Code that draws the rules at the bottom of the table according the theme options. SEE ALSO
LaTeX::Table The predefined templates: LaTeX::Table::Types::Std, LaTeX::Table::Types::Ctable, LaTeX::Table::Types::Longtable, LaTeX::Table::Types::Xtab LICENSE AND COPYRIGHT
Copyright (c) 2006-2010 "<limaone@cpan.org>" This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. perl v5.10.1 2010-10-27 LaTeX::Table::Types::TypeI(3pm)
All times are GMT -4. The time now is 06:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy