Re: newbie question about removing un needed extra lines

Discussion in 'Perl' started by Ned D Hanks, Aug 4, 2003.

  1. Ned D Hanks

    Ned D Hanks Guest

    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:
    >
    >
    >
    >
    >
    >
    >
    >
    > should turn into
    >
    >
    >
    >
    >
    >
    >
    > 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.
    Ned D Hanks, Aug 4, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Taylor
    Replies:
    2
    Views:
    1,095
    Eric J. Roode
    Aug 4, 2003
  2. Andy Fish
    Replies:
    1
    Views:
    1,439
    Andy Fish
    Dec 21, 2004
  3. mathieu
    Replies:
    3
    Views:
    594
    Bo Persson
    Sep 4, 2009
  4. OccasionalFlyer

    Removing Extra Table Cell

    OccasionalFlyer, Feb 28, 2011, in forum: HTML
    Replies:
    22
    Views:
    949
    Jonathan N. Little
    Mar 2, 2011
  5. Siobhan

    Removing extra information from Soap Exception

    Siobhan, Feb 19, 2005, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    179
    Guest
    Feb 23, 2005
Loading...

Share This Page