Sponsored Content
Top Forums Shell Programming and Scripting Find and replace variables using a csv table Post 302740699 by Don Cragun on Thursday 6th of December 2012 04:07:44 PM
Old 12-06-2012
Hi biscayne,
If you can show us an example of your template file and a corresponding sample of the output you want to get (based on your example template and CSV files), we can probably give you an awk script that will do it all in one step.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HTML table to CSV

Hi !! I have HTML Tables through which i want to generate graphs, but for creating graphs i need the file in CSV format so can anyone can please help me in how can i convert my HTML table file to CSV format. Thanks in Advance (2 Replies)
Discussion started by: i_priyank
2 Replies

2. UNIX for Dummies Questions & Answers

How do I read/find/replace fields in a csv datafile?

hello. I'm somewhat a novice here so please be patient. My stumbling block when loading csvs into ORACLE tables is this: I need to read a csv datafile, check several fields in each line, and if any of stated fields contain A ZERO only then replace it with a null/blank character. I had a... (9 Replies)
Discussion started by: MrCarter
9 Replies

3. Shell Programming and Scripting

csv to table one-liner

I've googled a lot on this, but could not fine a simple one-liner to do this. I have a .csv file that looks like this: Header one Header two Header three col1,col2,col3 short data, very long data, dataIf I use sed and change the comma to tab, being the colums of variable length I don't get a... (6 Replies)
Discussion started by: ahsog
6 Replies

4. Shell Programming and Scripting

find & replace comma in a .csv file.

HI, Please find the text below. I receive a .csv file on server. I need the comma(,) in the second column to be replaced by a semi-colon( ; ). How to do it. Please help. Sample text: "1","lastname1,firstname1","xxxxxx","19/10/2009","23/10/2009","0","N","Leave"... (2 Replies)
Discussion started by: libin4u2000
2 Replies

5. Shell Programming and Scripting

Converting .xls into .csv and find & Replace

Hi All, Please give me the solution to the following ASAP. 1) Converting the .xls into .csv Script i tried, mv hello.xls hello.csv The above given script converting the .xls file into .csv successfully. But after i run the below unix command I am no able to open the .csv file, its giving... (4 Replies)
Discussion started by: velava
4 Replies

6. UNIX for Dummies Questions & Answers

Storing data from a table into a csv file

Hi I need to write a bash script to take the data stored in 3 oracle tables .. and filter them and store the results in a csv file. It is an Oracle database Thank you (1 Reply)
Discussion started by: ladyAnne
1 Replies

7. Shell Programming and Scripting

Convert file in csv or table

Hi there, i have a file like that in attachment (PLEVA3_280711_SAP.txt), i would extract some basic information from it and report in a new file or table like this: i try to use bash and i extract the single object in this way (see attach scriptino.sh), but i receive a strange... (5 Replies)
Discussion started by: alen192
5 Replies

8. UNIX for Dummies Questions & Answers

Find & Replace identifiers using a conversion table

Hi ! I have input.tab with one column containing Item IDs under a number format (the second column is the Location of this item): Location Item ID rack1 12; 35; 43 rack35 23; 894; 5478; 98 etc... (The number of Items per row is variable. Item IDs in a same field are... (17 Replies)
Discussion started by: lucasvs
17 Replies

9. Shell Programming and Scripting

Update the table using values from a csv file

i want to run update query for oracle which is in up.sql taking values from a.csv. I have implemented shell script to do it. extn="perl" ls -1 | while read file do echo "$file,$extn" > a.csv done up.sql contains update file_list set filename=$1 where extn=$2; The code to update is... (2 Replies)
Discussion started by: millan
2 Replies

10. UNIX for Beginners Questions & Answers

Generate files and use csv data to replace multiple variables in a template

I have a source csv file consists of first field as variable name, and the rest are site-specific information (converted from excel file, where site -specific values in columns). I am trying to create a file for every site using a template and replace the multiple variables with values from the... (3 Replies)
Discussion started by: apalex
3 Replies
LedgerSMB::Template(3pm)				User Contributed Perl Documentation				  LedgerSMB::Template(3pm)

NAME
LedgerSMB::Template - Template support module for LedgerSMB SYNOPSIS
This module renders templates. METHODS
new(user => \%myconfig, template => $string, format => $string, [locale => $locale] [language => $string], [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool], [debug => $bool], [output_file => $string] ); This command instantiates a new template: template The template to be processed. This can either be a reference to the template in string form or the name of the file that is the template to be processed. format The format to be used. Currently HTML, PS, PDF, TXT and CSV are supported. format_options (optional) A hash of format-specific options. See the appropriate LSMB::T::foo for details. output_options (optional) A hash of output-specific options. See the appropriate output method for details. locale (optional) The locale object to use for regular gettext lookups. Having this option adds the text function to the usable list for the templates. Has no effect on the gettext function. language (optional) The language for template selection. include_path (optional) Overrides the template directory. Used with user interface templates. no_auto_output (optional) Disables the automatic output of rendered templates. no_escape (optional) Disables escaping on the template variables. debug (optional) Enables template debugging. With the TT-based renderers, HTML, PS, PDF, TXT, and CSV, the portion of the template to get debugging messages is to be surrounded by <?lsmb DEBUG format 'foo' ?> statements. Example: <tr><td colspan="<?lsmb columns.size ?>"></td></tr> <tr class="listheading"> <?lsmb FOREACH column IN columns ?> <?lsmb DEBUG format '$file line $line : [% $text %]' ?> <th class="listtop"><?lsmb heading.$column ?></th> <?lsmb DEBUG format '' ?> <?lsmb END ?> </tr> method/media (optional) The output method to use, defaults to HTTP. Media is a synonym for method output_file (optional) The base name of the file for output. available_formats() Returns a list of format names, any of the following (in order) as applicable: HTML (always available) TXT (includes CSV, always available)) PDF PS XLS ODS new_UI(user => \%myconfig, locale => $locale, template => $file, ...) Wrapper around the constructor that sets the path to 'UI', format to 'HTML', and leaves auto-output enabled. render($hashref) This command renders the template. If no_auto_output was not specified during instantiation, this also writes the result to standard output and exits. Otherwise it returns the name of the output file if a file was created. When no output file is created, the output is held in $self->{output}. Currently email and server-side printing are not supported. output This function outputs the rendered file in an appropriate manner. my $bool = _valid_language() This command checks for valid langages. Returns 1 if the language is valid, 0 if it is not. column_heading() Apply locale settings to column headings and add sort urls if necessary. escape($string) Escapes a scalar string if the format supports such escaping and returns the sanitized version. Copyright 2007, The LedgerSMB Core Team This file is licensed under the GNU General Public License version 2, or at your option any later version. A copy of the license should have been included with your software. perl v5.14.2 2012-05-30 LedgerSMB::Template(3pm)
All times are GMT -4. The time now is 08:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy