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 *
|