HP3000-L Archives

September 2006, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Ken Hirsch <[log in to unmask]>
Reply To:
Ken Hirsch <[log in to unmask]>
Date:
Wed, 13 Sep 2006 12:59:22 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (61 lines)
A Perl program will do this:
#!perl -w
use Text::ParseWords;

while (<>) {
  chomp;
  print pack("A3A4A3A1A2", quotewords(",", 0, $_)), "\n";
}



 From the shell, you can even do it with a one-liner:
perl -MText::Parsewords -lne 'print pack "A3A4A3A1A2", quotewords(",", 
0, $_)'  INPUTFILE >OUTPUT

Notes:
  File names given as arguments to perl on command line must be in HFS 
syntax.
  Files created by the Posix shell with output redirection are 
bytestream files. 
  Perl can read/write MPE fixed-length or variable-length files with the 
bytestream emulation that is built in to MPE's Posix layer.



prabhu rajkumar wrote:
> I have an issue reading the CSV file in MPE. I have to 
>   
> Hi all,
>
> I have an issue reading the CSV file in MPE. I have to read the CSV file and create the fixed length regords in MPE. Could you please help. For example, If my file is as below
>
> Column A 3bytes
> Column B 4bytes
> Column C 3bytes
> Column D 1byte
> Column E 2bytes
>
>
> abc,123,wzf,,1
> 123,fgh,34,1,5
>
> My output file should be like below.
>
> abc123 wzf 1 
> 123fgh 34 15 
>
> Please do help me out.
>
> Thanks in advance,
> Prabhu
>
>
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
>
>   

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2