Sponsored Content
Top Forums Shell Programming and Scripting Reading from a CSV and writing in same CSV file Post 302698013 by kmajumder on Friday 7th of September 2012 06:04:27 PM
Old 09-07-2012
Yes. I have figured out that. I just need to know how I modify the same CSV file while reading it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script for reading .csv file

Can someone please help me to write script for following scenario : 1> script should read a input .csv file of format : EmpName, PF, Leave, Basic ,HRA 2> another config file ( may be again a .csv file ) has format EmpName and EmpID 3> script should read another config file for each EmpName in... (3 Replies)
Discussion started by: creativeworld
3 Replies

2. Shell Programming and Scripting

writing to a csv file

Hi buddies i have doubt. I 'm new to unix script and learning. I have a req. I need to find the values mentioned in the double quoutes of each line and write it into a csv file. How do I handle this? Please help me. SCTY_ISS_ID (SCTY_ISS_ID:Dec18Fixed.0:): "37927320080309" TRD_DT... (6 Replies)
Discussion started by: pstanand
6 Replies

3. Shell Programming and Scripting

reading from a .csv file

Hi , Can anyone please help me to read the value from the .csv file? This is my .csv file: dirnames: first,second i want to get the two names and create directories correspondingly (1 Reply)
Discussion started by: novice_user
1 Replies

4. UNIX for Advanced & Expert Users

Issue reading csv file

HI All I have csv file containing the data like this Electrical Equipment,ElecEquip "Engineering, Machinery & Equipment",Engineerin Entertainment & Broadcasting,Entertain The first and third record are fine,The issue with second records as it has comma enclosed with in inverted... (1 Reply)
Discussion started by: mohdtausifsh
1 Replies

5. Shell Programming and Scripting

Reading variables from CSV file

Hi I am using KSH and trying to read variables from a csv file. I've set the IFS=, and it workds. Problem is where one of the values is text containing a comma. For example the following lines exist in my file. How can I read everything between the quotes into a single variable? APW13812,,1... (2 Replies)
Discussion started by: ventris
2 Replies

6. Shell Programming and Scripting

Need help in writing a routine for sorting a CSV file

Hi, I have a CSV file in following manner: server1,env1,patch1 server1,env1,patch2 server1,env1,patch3 server1,env2,patch1 server1,env2,patch3 server2,env3,patch1 server2,env3,patch5 server2,env4,patch1 server3,env6,patch1 server3,env7,patch2 server3,env7,patch3 I want to... (6 Replies)
Discussion started by: avikaljain
6 Replies

7. Shell Programming and Scripting

Reading last line of a CSV file

Hi I have a file which I am reading line by line and processing it. But the last line is not getting read in the file loop until I put an enter in the end. #!/bin/ksh -p v_org_id=${P1} FILE=${P2} NEW_FILE_NAME=$APPLPTMP/b1.txt BAKIFS=$IFS IFS=$'\n' exec 0<"$FILE" echo "File to be... (2 Replies)
Discussion started by: Chinky23
2 Replies

8. Shell Programming and Scripting

Reading the value of particular column from csv file

Hi Folks, I have the below csv file which is comma delimited , now from this file i need to read the value of the column der_id and then want to create a separate text file which will contain the value of the column der_id only please advise how to read the value of the column der_id and then... (3 Replies)
Discussion started by: punpun66
3 Replies

9. UNIX for Dummies Questions & Answers

Writing multiple outputs in to separate cells of CSV file

Hi I am writing a script which has multiple awk statements and each statement gives me a numeric count as an output. I want those output to be stored in different cells of a csv file. say 12 awk statements give 12 output and i want them in diffrenet cells of csv file. Thank you guys..!! (4 Replies)
Discussion started by: prabhat.diwaker
4 Replies

10. Shell Programming and Scripting

Reading CSV file

Hi experts, Im having csv file with few columns which should contain data as shown below. Want to check if column 3 contain row with duplicate value(9876,9876) then corresponding to this in col2 should contain text "tax" and should not contain text "non". Word "non" can come but if in column3... (2 Replies)
Discussion started by: as7951
2 Replies
Text::CSV::Encoded::Coder::Base(3pm)			User Contributed Perl Documentation		      Text::CSV::Encoded::Coder::Base(3pm)

NAME
Text::CSV::Encoded::Coder::Base - Interface for Text::CSV::Encoded coder base class SYNOPSIS
package Text::CSV::Encoded::Coder::YourCoder; use base qw( Text::CSV::Encoded::Coder::Base ); sub decode { ... } sub encode { ... } sub upgrade { ... } sub decode_fields_ref { ... } sub encode_fields_ref { ... } DESCRIPTION
This module is used by Text::CSV::Encoded internally. INTERFACS
decode ( $self, $encoding, $str ) = @_; .... return $decoded_str; Takes an encoding and a CSV string. It must return a Perl string decoded in $encoding. In Perl 5.8 or later, if $enc is "undef" or false, the encoding should be utf8. encode ( $self, $encoding, $str ) = @_; .... return $encoded_str; Takes an encoding and a Perl string. It must return a CSV string encoded in $encoding. In Perl 5.8 or later, if $enc is "undef" or false, the encoding should be utf8. decode_fields_ref ( $self, $encoding, $arrayref ) = @_; Takes an encoding and an array reference. It must decoded each array entries in $encoding. encode_fields_ref ( $self, $encoding, $arrayref ) = @_; Takes an encoding and an array reference. It must encoded each array entries in $encoding. upgrade ( $self, $str ) = @_; In Perl 5.8 or later, it is expected to do "utf8::upgrade" against $str. In older versions, this method may be meaningless and there is no need to implement. See to utf8. encode_check_value Setter/Getter for an argument passing to encode. $coder->encode_check_value( Encode::FB_PERLQQ ); decode_check_value Setter/Getter for an argument passing to decode. $coder->encode_check_value( Encode::FB_PERLQQ ); EXAMPLE
Use with Jcode. package Text::CSV::Encoded::Coder::Jcode; use strict; use base qw( Text::CSV::Encoded::Coder::Base ); use Jcode (); my $Jcode = Jcode->new; my %alias = ( 'shiftjis' => 'sjis', 'euc-jp' => 'euc', 'sjis' => 'sjis', 'euc' => 'euc', ); sub decode { my ( $self, $encoding, $str ) = @_; my $enc = $alias{ $encoding }; $Jcode->set( $str, $enc )->euc; } sub encode { my ( $self, $encoding, $str ) = @_; my $enc = $alias{ $encoding }; $Jcode->set( $str, 'euc' )->$enc(); } sub decode_fields_ref { my ( $self, $encoding, $arrayref ) = @_; my $enc = $alias{ $encoding }; for ( @$arrayref ) { $_ = $Jcode->set( $_, $enc )->euc; } } sub encode_fields_ref { my ( $self, $encoding, $arrayref ) = @_; my $enc = $alias{ $encoding }; for ( @$arrayref ) { $_ = $Jcode->set( $_, 'euc' )->$enc(); } } AUTHOR
Makamaka Hannyaharamitu, <makamaka[at]cpan.org> COPYRIGHT AND LICENSE
Copyright 2008-2010 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-04-26 Text::CSV::Encoded::Coder::Base(3pm)
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy