Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




After Work

Highlife Adventures
The best club in Chicago
for Chicago Singles is Highlife Adventures!






Kyoto Sushi
in Chicago, on Lincoln Ave.
Moody's Pub
in Chicago, has great burgers
Skylark
in Chicago, on Halsted .. excellent beer selection!


UNIX » Perl » Coding »

CSV File Processor

     




#!/usr/bin/perl
# --------------------------------------
# Process data file, and convert to
# CSV quote delimited format
# --------------------------------------

use Text::ParseWords ;


while (<STDIN>) {
$line1 = $_ ;

chomp $line1 ;

$line1 =~ s/\\/0/;
$line1 =~ s/X/Z/;

#print $line1 , "\n" ;

@flist = parse_it ($line1) ;

for ($i=0;$i<@flist;$i++)
{
if ( $i > 0 )
{
$line2 = $line2 . "|";
}
else
{
$line2 = "";
}

$line2 = $line2 . $flist[$i];
}

print $line2 , "\n" ;
}

sub parse_it {

return quotewords(",", 0, @_ );

}









UNIX : Related Topics

UNIX : Perl : Text file processor - sewing paragraphs together
UNIX : Perl : Replace characters in a file via Perl utility
UNIX : Perl : Remove exponents in a floating number
UNIX : Perl : Set precision of a numeric string
UNIX : Perl : Parse command line options
UNIX : Perl : HTML directive for Perl CGI
UNIX : Perl : Binary File Viewer
UNIX : Perl : Compare Two Binary Files
UNIX : Perl : Binary File Cutter
UNIX : Perl : Arrays and Lists

Sybase Web Site
Sybase Mobile Web Site
Oracle Web Site





Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2010 Stoltenbar Inc All Rights Reserved.