Sponsored Content
Top Forums Shell Programming and Scripting Make Multile line is one line using window Perl Post 302749505 by DGPickett on Friday 28th of December 2012 01:00:57 PM
Old 12-28-2012
The linefeeds are inside quotes, so the PERL CSV lib can pick them up, and all you need to do is replace line feed with space inside the fields.

Doing CSV in PERL without using the CSV libs seems like bad form, reinventing the wheel. If there were quoted commas in your fields, this would fall apart, so it is not robust.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multile Pattern Search in a same line and delete

HI Gurus, I need to delete a line from a syslog file, if it matches three conditions. Say for ex., if the device name is device.name.com and if it contains the syslog message PAGP-5-PORTFROMSTP in between the time period 00:00:00 to 04:00:00, then the particular line has to be deleted from... (2 Replies)
Discussion started by: sasree76
2 Replies

2. Shell Programming and Scripting

make multiple line containing a pattern into single line

I have the following data file. zz=aa azxc-1234 aa=aa zz=bb azxc-1234 bb=bb zz=cc azxc-1234 cc=cc zz=dd azxc-2345 dd=dd zz=ee azxc-2345 ee=ee zz=ff azxc-3456 ff=ff zz=gg azxc-4567 gg=gg zz=hh azxc-4567 hh=hh zz=ii azxc-4567 ii=ii I want to make 2nd field pattern matching multiple lines... (13 Replies)
Discussion started by: VTAWKVT
13 Replies

3. Shell Programming and Scripting

Perl script to search a line and copy it to another line

Hi I have a log file (say log.txt). I have to search for a line which has the string ( say ERROR) in the log file and copy 15 lines after this into another file (say error.txt). Can someone give me the code and this has to be in PERL Thanks in advance Ammu (3 Replies)
Discussion started by: ammu
3 Replies

4. Shell Programming and Scripting

PERL or SHELL Scrript to search in Directories by taking line by line from a text file

Unix box server version *********** >uname -r B.11.00 >echo $SHELL /usr/bin/ksh --> in this server, I have the path like /IMbuild/dev/im0serv1 ---> in that directory I have the folders startup(.jsp files nearly 100 jsp's ) and scripts(contains .js files nearly 100 files) ... (9 Replies)
Discussion started by: pasam
9 Replies

5. Shell Programming and Scripting

perl: comparision of field line by line in two files

Hi everybody, First I apologize if my question seems demasiad you silly, but it really took 4 days struggling with this, I looked at books, forums ... And Also ask help to a friend that is software developer and he told me that it is a bad idea do it by perl... but this is my problem. I moved to... (8 Replies)
Discussion started by: Thelost
8 Replies

6. Shell Programming and Scripting

Perl how to compare two pdf files line by line

Hi Experts, Would really appreciate if anyone can guide me how to compare two pdf files line by line and report the difference to another file. (3 Replies)
Discussion started by: prasanth_babu
3 Replies

7. Shell Programming and Scripting

Perl : Assigning multile hash values to a single array

I know that @food = %fruit; Works. But how do I assign %fruit and %veggies to @food ? (2 Replies)
Discussion started by: popeye
2 Replies

8. Shell Programming and Scripting

Perl to extract information from a file line by line

In the below perl code I am using tags within each line to extract certain information. The tags that are used are: STB >0.8 is STRAND BIAS otherwise GOOD FDP is the second number GO towards the end of the line is read into an array and the value returned is outputed, in the first line that... (1 Reply)
Discussion started by: cmccabe
1 Replies

9. Shell Programming and Scripting

Perl command line option '-n','-p' and multiple files: can it know a file name of a printed line?

I am looking for help in processing of those options: '-n' or '-p' I understand what they do and how to use them. But, I would like to use them with more than one file (and without any shell-loop; loading the 'perl' once.) I did try it and -n works on 2 files. Question is: - is it possible to... (6 Replies)
Discussion started by: alex_5161
6 Replies

10. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 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 08:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy