- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Coverting csv file to binary
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 08:48 PM
тАО04-04-2005 08:48 PM
Is there a way to covert csv file to its binary equivalent. I have attached the sample files.
Hope u guys can help me out..
thanks!!
Henry
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-04-2005 08:49 PM
тАО04-04-2005 08:49 PM
Re: Coverting csv file to binary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 12:19 AM
тАО04-05-2005 12:19 AM
Re: Coverting csv file to binary
I've looked at the binary file but it has things missing from the original file.
I even saw a backspace character in it (which is weird for a file format).
How did you get the cvs file into that binary format?
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 12:36 AM
тАО04-05-2005 12:36 AM
Re: Coverting csv file to binary
BUT!
M$ has never been able to read the specs. CSV is shorthand for COMMA Separated Values, and guess what M$ uses? Right, a semicolon. So in order to convert microshit generated csv files, you need
# perl -MText::CSV_XS -le'$c=Text::CSV_XS->new({binary=>1,sep_char=>";"});while(<>){$c->parse($_);print$c->fields}' file.csv > file.dta
HTH, Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 12:40 AM
тАО04-05-2005 12:40 AM
Re: Coverting csv file to binary
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 01:00 AM
тАО04-05-2005 01:00 AM
Re: Coverting csv file to binary
Sorry I am new to Perl, can u explain how your script actually works.. I tried running it on my system. doesnt seem to work
Best regards
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 01:03 AM
тАО04-05-2005 01:03 AM
Re: Coverting csv file to binary
What I really want to do is to convert csv file to its binary equivalent. This binary file is generated by a customise program, in actual I am not even sure if the conversion is possible.. just trying my luck..
Thanks!! =)
regards
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 01:14 AM
тАО04-05-2005 01:14 AM
Solutionperl -MText::CSV_XS -le'$c=Text::CSV_XS->new({binary=>1,sep_char=>";"});while(<>){$c->parse($_);print$c->fields}' file.csv > file.dta
is more verbose,as a script, more or less the same as (with comments):
--8<--- csv2bin.pl
#!/opt/perl/bin/perl
# this line tell where your perl resides
use strict; # Don't allow ambiguous code
use warnings; # Warn me wherever appropriate
use Text::CSV_XS; # use the Text::CSV_XS module.
# Should be installed from CPAN or bundled in the port you got
my $csv = Text::CSV_XS->new ({ # create a new csv handle
binary => 1, # that uses binary data
sep_char => ";", # and a semicolon as separator
});
# Now parse the input lines
while (<>) {
$csv->parse ($_); # break down as valid csv
print $csv->fields; # and print the fields as binary
}
-->8---
First check if you have perl, and what version:
# perl -v
If you don't have it (yet), you can get it from my site, and my builds include CSV_XS
My HP ITRC site pages can be found at (please use LA as primary choice):
USA Los Angeles http://mirrors.develooper.com/hpux/
SGP Singapore https://www.beepz.com/personal/merijn/
USA Chicago http://ww.hpux.ws/merijn/
NL Hoofddorp http://www.cmve.net/~merijn/
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 01:29 PM
тАО04-05-2005 01:29 PM
Re: Coverting csv file to binary
Sorry for getting your name wrong. =p
I have gotten this when i probed the machine.
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
Copyright (c) 1989, 1990, 1991, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 4.0 source kit.
Will this version work? Where can I grt the "CSV_XS" for this version?
Thank u for your help..
=)
Regards
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-05-2005 02:00 PM
тАО04-05-2005 02:00 PM
Re: Coverting csv file to binary
Bill Hassell, sysadmin