|
Hi Rune,
Just an idea to work out: indeed use the _INFILE_ variable while reading
and interpreting the file. If it is empty (only contains space) it
represents an empty line. Don't write it to the output file yet, but
remember the number of empty lines read. Continue reading input lines and
add possible additional empty lines to remember, until a non-empty line is
being read. Before writing that line and if it does not consist of '-----'
firstly output (PUT;) the number of empty lines that were remembered. In
any case reset the number of remembered empty lines to 0 and output your
currently read line.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Tue, 11 Apr 2006 07:50:09 +0200, Rune Runnestø <rune@FASTLANE.NO> wrote:
>Hi,
>
>Below is an example of a file with some unwanted blank lines within it -
>File 1.
>File 2 shows the result after the SAS code (which I don't know how to make)
>has
>processed File 1. The only blank lines I want to remove, are thoose *above*
>the
>'-------' line. Eventually blank lines between the '------' line and the
>CASE NUMBER.. line,
>between CASE NUMBER... and TITLE or between the two TITLE lines are
>to remain.
>I presume that _infile_ can be a good candidate to use here. And some kind
>of loop
>I guess. May be two loops. Where the outer loop locate the '-----' lines
and
>the inner
>loop removes the unwanted blank lines.
>
>Does anyone have a suggestion how this code will look like ?
>
>Rune
>
>
>
>-File 1 starts here-
>
>------------------------------------------------
>CASE NUMBER: 1
>
> TITLE: First case, first title
>
> TITLE: First case, second title
>
>
>------------------------------------------------
>CASE NUMBER: 2
> TITLE: Second case, first title
> TITLE: Second case, second title
>
>------------------------------------------------
>
>
>CASE NUMBER: 3
> TITLE: Third case, first title
>
>
> TITLE: Third case, second title
>
>
>
>
>------------------------------------------------
>-File 1 ends here-
>
>
>
>
>-File 2 starts hers-
>------------------------------------------------
>CASE NUMBER: 1
>
> TITLE: First case, first title
>
> TITLE: First case, second title
>------------------------------------------------
>CASE NUMBER: 2
> TITLE: Second case, first title
> TITLE: Second case, second title
>------------------------------------------------
>
>
>CASE NUMBER: 3
> TITLE: Third case, first title
>
>
> TITLE: Third case, second title
>------------------------------------------------
>-File 2 ends here-
|