Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl (http://www.velocityreviews.com/forums/f17-perl.html)
-   -   Re: newbie question about removing un needed extra lines (http://www.velocityreviews.com/forums/t24239-re-newbie-question-about-removing-un-needed-extra-lines.html)

Ned D Hanks 08-04-2003 03:30 AM

Re: newbie question about removing un needed extra lines
 
Scott Taylor wrote:
>
> I've just started learning perl, and had two questions. One, what is
> the best way to open a text file and remove all of the empty lines?
> Example:
>
> a@a.com
> b@b.com
>
> c@c.com
>
> d@d.com
>
> should turn into
>
> a@a.com
> b@b.com
> c@c.com
> d@d.com
>
>
> Also, what is the best source to learn perl? I've heard that the
> O'Reilly Books are supposed to be very helpful. Can anyone recommend a
> good web source with tutorials for newbies?
>
> Thanks in advance,
>
> Scott Taylor
>


perl -i -n -e 'print if ! /^$/;'

I'll leave it up to you to look at the perl docs for an explaination.

Look at man perl, man perlrun, man prelregquick, and man perlregtut.



All times are GMT. The time now is 11:21 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57