If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Remove Blank Lines from Multiple Files

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-08-05, 10:05
normanjr29 normanjr29 is offline
Registered User
 
Join Date: Apr 2004
Location: Winston-Salem, NC
Posts: 25
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
Reply With Quote
  #2 (permalink)  
Old 03-08-05, 12:05
normanjr29 normanjr29 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On