script to remove blank lines ?

1999-08-10 Thread venu
hi all shell scripters !

if in a file I have say 10 lines and some of them are blank lines ,how do i
remove the blank lines ?

cherio
venu



Re: script to remove blank lines ?

1999-08-10 Thread Stephan Engelke
Hi,

On Tue, Aug 10, 1999 at 12:25:03PM +0530, venu wrote:

 if in a file I have say 10 lines and some of them are blank lines ,how do i
 remove the blank lines ?

grep -v ^$ filename

This gets you all lines with something between the line's beginning (^)
and its end ($).  Or rather without nothing between beginning and
end (-v is grep's negation option).

So long -- Stephan
-- 
Stephan Engelke[EMAIL PROTECTED]
 *** Plug-and-Play is really nice, unfortunately it only works 50% of
 the time.  To be specific the Plug almost always works. ***


Re: script to remove blank lines ?

1999-08-10 Thread venu
hey... that was quick !! thanks stephan...

Stephan wrote:...

grep -v ^$ filename

This gets you all lines with something between the line's beginning (^)
and its end ($).  Or rather without nothing between beginning and
end (-v is grep's negation option).



i did it like this uing awk.

cat m | awk '$1 != { print  $1 }'

but i believe ur method would be faster !!

thanks
venu




Re: script to remove blank lines ?

1999-08-10 Thread Michael Merten
On Tue, Aug 10, 1999 at 12:25:03PM +0530, venu wrote:
 hi all shell scripters !
 
 if in a file I have say 10 lines and some of them are blank lines ,how do i
 remove the blank lines ?
 
 cherio
 venu
 
Well, one way would be to 'cat file | tr -s '\n'  newfile',
IIRC.

Mike

[Private mail welcome, but no need to CC: me on list replies.]

--
Michael Merten  [EMAIL PROTECTED]
  --- Debian GNU/Linux Fan -- http://www.debian.org
  --- CenLA-LUG Founder -- http://www.angelfire.com/la2/cenlalug
--
Driving in Texas is simple.  For the first 100 miles you swerve to
avoid jackrabbits.  For the second 100 miles you hit whatever
jackrabbits get in the way.  After that you chase off into the brush
after them.


RE: script to remove blank lines ?

1999-08-10 Thread Wim Kerkhoff
cat --help

cat -s temp  temp1

This will reduce multiple blank lines to 1 blank line, see the other responses
if you want that line gone too.  If you have a long file with a page of blank
space, cat -s README would fix that for you.   

On 10-Aug-99 venu wrote:
 hi all shell scripters !
 
 if in a file I have say 10 lines and some of them are blank lines ,how do i
 remove the blank lines ?
--
 Wim Kerkhoff  
 [EMAIL PROTECTED]
 www.canadianhomes.net/wim 
 ICQ: 23284586