The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
delete traling blank lines only visu UNIX for Dummies Questions & Answers 1 03-05-2008 06:09 PM
delete blank lines from a file sachin.gangadha UNIX for Dummies Questions & Answers 2 12-04-2007 04:13 PM
Delete blank lines at the end of file TL56 Shell Programming and Scripting 3 10-25-2007 12:44 PM
regex to delete multiple blank lines in a file? fedora Shell Programming and Scripting 6 10-11-2007 01:36 PM
delete blank lines or lines with spaces only vascobrito UNIX for Dummies Questions & Answers 3 01-13-2004 04:36 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-30-2005
tmxps's Avatar
Registered User
 

Join Date: Sep 2005
Posts: 8
delete blank lines with sed

I have a text file with blank lines fullfilled with spaces and others only containing the "Enter" caracter, the \012.

I would like to eliminate all them with the sed command.

Is it possible?

making: sed '/^$/d' <file should delete the blank lines but doesn't work for the lines that only have \012.

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2  
Old 10-30-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
Try this:
sed '/^ *$/d'
Reply With Quote
  #3  
Old 08-21-2007
buldir's Avatar
Registered User
 

Join Date: Aug 2007
Posts: 1
This thread is ancient, but I wanted to say thanks to Perderabo. Your solution helped me out big time.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:01 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0