Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Preventing lines from printing

0 views
Skip to first unread message

Diamond, Mark

unread,
Aug 22, 2009, 10:00:49 PM8/22/09
to
Hello,

I am processing multiple text files. There is a lot of pre-processing before
the file-reading commences, then each file gets read (but I don't want to
print any blank line) and then there is a lot of post-processing of each
file. In AWK I had a BEGIN block, no print lines in the middle, and a very
long END block. In Perl, I have

pre-code
while (<>) {
lots of processing of file lines with only one wanted "print"
}
post-processing

but I get a blank line output on any line that I don't actually do an
explicit print for. I thought "perl -n" would give me what I need but it
doesn't (of course) because of the wrapped "while(<>) { }" .

Please ... what should I be doing?

Mark


Grant Taylor

unread,
Aug 24, 2009, 12:27:20 AM8/24/09
to
On 8/22/2009 9:00 PM, Diamond, Mark wrote:
> pre-code
> while (<>) {
> lots of processing of file lines with only one wanted "print"
> }
> post-processing

> Please ... what should I be doing?

Can we see the actual code for 'lots of processing of file lines with
only one wanted "print"'?

I'm wondering if you aren't emptying a variable and still printing the
empty variable.

Grant. . . .

R M

unread,
Sep 4, 2009, 9:30:24 PM9/4/09
to
Do you chop the input line to remove the '\n'?
0 new messages