[Info-vax] wrong file format
Hein RMS van den Heuvel
heinvandenheuvel at gmail.com
Wed Dec 23 12:58:17 EST 2020
On Wednesday, December 23, 2020 at 11:41:45 AM UTC-5, Michael Moroney wrote:
> Try the following:
>
> $ COPY NL: NEWFILE.DAT
> $ APPEND OLDFILE.DAT NEWFILE.DAT
Good. The copy command creates an empty default file = variable length sequential file.
Silly, less known, FDL hints
1)
An empty FDL file also defaults to a variable length sequential file.
Therefor you can use things like: CONVERT/STAT/FDL=NL: OLDFILE.DAT NEWFILE.DAT
2)
Instead of an FDL file you can specify an FDL string on most DCL commands.
For example to create a stream-lf file, you can use:
$ convert/fdl="record; format stream_lf" OLDFILE.DAT NEWFILE.DAT
To create a trivial indexed file to play with, with 10 byte key length starting at default byte 0:
$ create/fdl="file; org ind; key 0; seg0_l 10" tmp.tmp
Back to Philip's question.
>> I see (in EDT) explicit carriage returns at the end of each line
So maybe we can just make those the terminator and then remove all LF bytes?
$ set file/att=rfm=stmcr x.x
now see what you have and deal with it.
I tried removing the linefeeds with simple Perl one liners, but they and up either giving double records per record (one empty) or single record with no terminators. Perl seems to remember stray LF bytes as line end.
You can possibly get there using:
$ perl -015 -l012 -pe "s/\n//g" nr.tmp > new.tmp
The -015 makes CR the input line terminator
The -l012 makes LF the output terminator added to each record as defined by the CR's
The -p adds an implicit simple while loop processing the input stream until EOF
The -e is an inline script "s/\n//g" telling it to replace any and all LF's in the records to be replaced by nothing.
Cheers,
Hein
More information about the Info-vax
mailing list