Sponsored Content
Top Forums Shell Programming and Scripting Blank Space is not appending in each row of CSV File - Shell Script Post 302313602 by praka on Wednesday 6th of May 2009 06:03:56 AM
Old 05-06-2009
MySQL Blank Space is not appending in each row of CSV File - Shell Script

I am calling SQL script in my UNIX Shell script and trying to create the CSV file and my last column value of each row is 23 blank spaces.

In my SQL script,the last column is like below.

RPAD(' ',23,' ') -- Padding 23 blank Spaces

The CSV file is generated but the sapce(23 spaces) is not appending in each row of the CSV file.

I edited the CSV file and the cursor is not allowing to go last column(23 spaces).

Pls help me to resolve this issue.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with appending to a csv file

I am working to import a file and have almost all the information accounted for except this last item. First of all the file name is the category and this is what I need to append to the file. The catch I believe is the fact the file name has spaces in it. Filename CPU Products.csv File... (3 Replies)
Discussion started by: nkr1ptd
3 Replies

2. UNIX for Dummies Questions & Answers

Shell Script: Traverse Database Table Row by Row

Hello Everyone, My issue is that I want to traverse a database table row by row and do some action on the value retrieved in each row. I have gone through a lot of shell script questions/posts. I could find row by row traversal of a file but not a database table. Please help. Thanks &... (5 Replies)
Discussion started by: ahsan.asghar
5 Replies

3. Shell Programming and Scripting

Want to remove the last characters from each row of csv using shell script

Hi, I've a csv file seperated by '|' from which I'm trying to remove the excess '|' characters more than the existing fields. My CSV looks like as below. HRLOAD|Service|AddChange|EN PERSONID|STATUS|LASTNAME|FIRSTNAME|ITDCLIENTUSERID|ADDRESSLINE1 10000001|ACTIVE|Testazar1|Testore1|20041|||... (24 Replies)
Discussion started by: rajak.net
24 Replies

4. Shell Programming and Scripting

Appending a parameter value to a .csv file???

Hi I have a date which I get as parameter. I want it to be added as first column in all the rows in a csv file. I have tried the below code but no success. date=$1 awk -F"," '{print $date","$0}' z3.csv > z4.csv Could you tell the correct code for the above req.? How to use code... (1 Reply)
Discussion started by: msp2244
1 Replies

5. Shell Programming and Scripting

Copying down first row in to all the below blank rows in a .csv file

Hi All, I have many of files(.csv) of the format given below. Date,Name,Location 04/02/2012,A,India ,B,China ,C,USA Like this I have 1000's of rows and many columns in all my files. I need a shell script to copy down the Date(in this example column1) to the next 2 rows below(in the... (8 Replies)
Discussion started by: ks_reddy
8 Replies

6. Shell Programming and Scripting

Ascii Mode appending extra records to csv file

I am relatively new to this forum and Unix scripting. ksh script: part 1 :will call a PL\SQL program will create 3 CSV file at the unix directory. part 2 : will sftp the files to the EFT server. Once the EFT server receives these file , it will transfer them to a shared windows folders. ... (3 Replies)
Discussion started by: developerpa
3 Replies

7. Shell Programming and Scripting

Appending = in particular column in csv file

Hi, I have a requirement to append = in particular row in csv file. Data in csv is as follow: row1,a,a,a row2,b,b,b row3,c,c,c row4,d,d,d csv should be modified at row3 and no. of columns are not fixed but rows are. output should be as: row1,a,a,a row2,b,b,b row3,=c,=c,=c... (2 Replies)
Discussion started by: Divya1987
2 Replies

8. Shell Programming and Scripting

Appending timestamp to a file. Why do I need this space ?

Version Info $ cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) $ $ echo $0 -ksh I was trying to append date to the file name. The following syntax has worked $ touch HELLO-`date '+%d-%b-%Y'`.txt $ ls -alrt HELL* -rw-r--r-- 1 rlapp oinstall 0 Feb 20... (2 Replies)
Discussion started by: John K
2 Replies

9. Shell Programming and Scripting

Remove Space and blank line from file in UNIX shell script

I have below file. I want to remove space at begining of every line and then after also remove blank line from file. I use below code for each operation. sed -e 's/^*//' < check.txt > check1.txt sed '/^\s*$/d' < check1.txt > check2.txt above code not remove all the space... (12 Replies)
Discussion started by: Mohin Jain
12 Replies

10. Shell Programming and Scripting

Help with Shell Scrip in Masking particular columns in .csv file or .txt file using shell script

Hello Unix Shell Script Experts, I have a script that would mask the columns in .csv file or .txt file. First the script will untar the .zip files from Archive folder and processes into work folder and finally pushes the masked .csv files into Feed folder. Two parameters are passed ... (5 Replies)
Discussion started by: Mahesh G
5 Replies
DBI::SQL::Nano(3)					User Contributed Perl Documentation					 DBI::SQL::Nano(3)

NAME
DBI::SQL::Nano - a very tiny SQL engine SYNOPSIS
BEGIN { $ENV{DBI_SQL_NANO}=1 } # forces use of Nano rather than SQL::Statement use DBI::SQL::Nano; use Data::Dumper; my $stmt = DBI::SQL::Nano::Statement->new( "SELECT bar,baz FROM foo WHERE qux = 1" ) or die "Couldn't parse"; print Dumper $stmt; DESCRIPTION
"DBI::SQL::Nano" is meant as a very minimal SQL engine for use in situations where SQL::Statement is not available. In most situations you are better off installing SQL::Statement although DBI::SQL::Nano may be faster for some very simple tasks. DBI::SQL::Nano, like SQL::Statement is primarily intended to provide a SQL engine for use with some pure perl DBDs including DBD::DBM, DBD::CSV, DBD::AnyData, and DBD::Excel. It is not of much use in and of itself. You can dump out the structure of a parsed SQL statement, but that is about it. USAGE
Setting the DBI_SQL_NANO flag By default, when a "DBD" uses "DBI::SQL::Nano", the module will look to see if "SQL::Statement" is installed. If it is, SQL::Statement objects are used. If SQL::Statement is not available, DBI::SQL::Nano objects are used. In some cases, you may wish to use DBI::SQL::Nano objects even if SQL::Statement is available. To force usage of DBI::SQL::Nano objects regardless of the availability of SQL::Statement, set the environment variable DBI_SQL_NANO to 1. You can set the environment variable in your shell prior to running your script (with SET or EXPORT or whatever), or else you can set it in your script by putting this at the top of the script: BEGIN { $ENV{DBI_SQL_NANO} = 1 } Supported SQL syntax Here's a pseudo-BNF. Square brackets [] indicate optional items; Angle brackets <> indicate items defined elsewhere in the BNF. statement ::= DROP TABLE [IF EXISTS] <table_name> | CREATE TABLE <table_name> <col_def_list> | INSERT INTO <table_name> [<insert_col_list>] VALUES <val_list> | DELETE FROM <table_name> [<where_clause>] | UPDATE <table_name> SET <set_clause> <where_clause> | SELECT <select_col_list> FROM <table_name> [<where_clause>] [<order_clause>] the optional IF EXISTS clause ::= * similar to MySQL - prevents errors when trying to drop a table that doesn't exist identifiers ::= * table and column names should be valid SQL identifiers * especially avoid using spaces and commas in identifiers * note: there is no error checking for invalid names, some will be accepted, others will cause parse failures table_name ::= * only one table (no multiple table operations) * see identifier for valid table names col_def_list ::= * a parens delimited, comma-separated list of column names * see identifier for valid column names * column types and column constraints may be included but are ignored e.g. these are all the same: (id,phrase) (id INT, phrase VARCHAR(40)) (id INT PRIMARY KEY, phrase VARCHAR(40) NOT NULL) * you are *strongly* advised to put in column types even though they are ignored ... it increases portability insert_col_list ::= * a parens delimited, comma-separated list of column names * as in standard SQL, this is optional select_col_list ::= * a comma-separated list of column names * or an asterisk denoting all columns val_list ::= * a parens delimited, comma-separated list of values which can be: * placeholders (an unquoted question mark) * numbers (unquoted numbers) * column names (unquoted strings) * nulls (unquoted word NULL) * strings (delimited with single quote marks); * note: leading and trailing percent mark (%) and underscore (_) can be used as wildcards in quoted strings for use with the LIKE and CLIKE operators * note: escaped single quotation marks within strings are not supported, neither are embedded commas, use placeholders instead set_clause ::= * a comma-separated list of column = value pairs * see val_list for acceptable value formats where_clause ::= * a single "column/value <op> column/value" predicate, optionally preceded by "NOT" * note: multiple predicates combined with ORs or ANDs are not supported * see val_list for acceptable value formats * op may be one of: < > >= <= = <> LIKE CLIKE IS * CLIKE is a case insensitive LIKE order_clause ::= column_name [ASC|DESC] * a single column optional ORDER BY clause is supported * as in standard SQL, if neither ASC (ascending) nor DESC (descending) is specified, ASC becomes the default TABLES
DBI::SQL::Nano::Statement operates on exactly one table. This table will be opened by inherit from DBI::SQL::Nano::Statement and implements the "open_table" method. sub open_table ($$$$$) { ... return Your::Table->new( \%attributes ); } DBI::SQL::Nano::Statement_ expects a rudimentary interface is implemented by the table object, as well as SQL::Statement expects. package Your::Table; use vars qw(@ISA); @ISA = qw(DBI::SQL::Nano::Table); sub drop ($$) { ... } sub fetch_row ($$$) { ... } sub push_row ($$$) { ... } sub push_names ($$$) { ... } sub truncate ($$) { ... } sub seek ($$$$) { ... } The base class interfaces are provided by DBI::SQL::Nano::Table_ in case of relying on DBI::SQL::Nano or SQL::Eval::Table (see SQL::Eval for details) otherwise. BUGS AND LIMITATIONS
There are no known bugs in DBI::SQL::Nano::Statement. If you find a one and want to report, please see DBI for how to report bugs. DBI::SQL::Nano::Statement is designed to provide a minimal subset for executing SQL statements. The most important limitation might be the restriction on one table per statement. This implies, that no JOINs are supported and there cannot be any foreign key relation between tables. The where clause evaluation of DBI::SQL::Nano::Statement is very slow (SQL::Statement uses a precompiled evaluation). INSERT can handle only one row per statement. To insert multiple rows, use placeholders as explained in DBI. The DBI::SQL::Nano parser is very limited and does not support any additional syntax such as brackets, comments, functions, aggregations etc. In contrast to SQL::Statement, temporary tables are not supported. ACKNOWLEDGEMENTS
Tim Bunce provided the original idea for this module, helped me out of the tangled trap of namespaces, and provided help and advice all along the way. Although I wrote it from the ground up, it is based on Jochen Wiedmann's original design of SQL::Statement, so much of the credit for the API goes to him. AUTHOR AND COPYRIGHT
This module is originally written by Jeff Zucker < jzucker AT cpan.org > This module is currently maintained by Jens Rehsack < jrehsack AT cpan.org > Copyright (C) 2010 by Jens Rehsack, all rights reserved. Copyright (C) 2004 by Jeff Zucker, all rights reserved. You may freely distribute and/or modify this module under the terms of either the GNU General Public License (GPL) or the Artistic License, as specified in the Perl README file. perl v5.18.2 2013-06-24 DBI::SQL::Nano(3)
All times are GMT -4. The time now is 12:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy