Ken Foskey wrote:
On Fri, 2007-09-21 at 15:50 +0500, [EMAIL PROTECTED] wrote:
There is a report that is generated from a script as a plain text file. I need to take this output file as input for my script and join them and create a CSV file and mail to me daily. How can I create CSV file with out using modules.
Taking a sample report ....
Hostname IP address Physical Address.
inxp1233 XXX.XXX.XXX.XXX Mac-address
inxp1432 XXX.XXX.XXX.XXX Mac-address
inxp1232 XXX.XXX.XXX.XXX Mac-address
A really simple solution is to substitute the spaces for comma:
$headings = <>; # read existing headings and discard
print "Hostname,IP address,Physical address\n";
while( $details = <> ) {
$details =~ s/\s+/,/;
ITYM:
chomp;
$details =~ s/\s+/,/g;
Or maybe just:
$details =~ tr/ \t/,/s;
print $details;
}
If I am joining this with a ',' and saving renaming the text file to CSV will
help or is there any other way to do it?Also I need to bold the header in my
CSV.
CSV is comma separated variable. It is a text format and therefore
cannot be 'bold'.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/