Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Location
    Winston-Salem, NC
    Posts
    25

    Unanswered: Remove Blank Lines from Multiple Files

    How can I remove/delete blank lines from multiple files in one swoop? This is about the closest I have come, but it obviously does not work. The "'/^$/d'" is sed syntax--does anyone know the perl syntax?

    perl -pi -e '/^$/d' *.stats.*

    Thanks,
    Jeff

  2. #2
    Join Date
    Apr 2004
    Location
    Winston-Salem, NC
    Posts
    25
    Quote Originally Posted by normanjr29
    How can I remove/delete blank lines from multiple files in one swoop? This is about the closest I have come, but it obviously does not work. The "'/^$/d'" is sed syntax--does anyone know the perl syntax?

    perl -pi -e '/^$/d' *.stats.*

    Thanks,
    Jeff
    This worked:

    perl -ni -e 'print unless /^$/../^$/' *.stats.*

    Thanks,
    Jeff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •