The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-10-2004
vascobrito vascobrito is offline
Registered User
  
 

Join Date: Oct 2003
Posts: 33
delete blank lines or lines with spaces only

hi there
i'm trying to delete blank lines and or lines with spaces only from a series of files in an directory.
to do so, i'm using this:

for files in `ls /users/myname/pesop* 2>/dev/null`
do
grep -v ^$ $files > newfile
mv newfile $files
done

now, this works great for blank lines but doesn't work for lines with spaces. The number of spaces is uncertain.
maybe it would be better with SED, but i dont know how to use it.
can anyone help me?
thanks