[Chicago-talk] removing blank lined header

Leland Johnson easyasy2k at gmail.com
Wed Sep 29 10:24:39 CDT 2004


perl -ne'BEGIN { $a = 0 } $a++ if(not /^$/); print if(!/^$/ or $a)' 
clunky, but works.

On Tue, 28 Sep 2004 20:51:41 -0500, andy_bach at wiwb.uscourts.gov
<andy_bach at wiwb.uscourts.gov> wrote:
> 
> No, not trying to remove all blank lines, just the first chunk of them. Its a 'filter' to be added to an SQL 'output to' line - the sql adds a few blank lines at the top and the script that handles the output has problems w/ that.  Its not my script (I'd hae delimited data and have perl do the  whole mess) just somebody looking for something more flexible than 'tail +5' as, apparently, its an indeterminate # of blank lines.
>  
> > perl -n -e 'print unless /^$/'
> 
> 
> I often use:
> perl -n -e 'print unless /^\s*$/'
> 
> which lets you skip blank but having whitespace lines.  I know things like email are 'guarenteed' to have an empty line in them, but ... BSTS.
>  
> a
> 
> Andy Bach, Sys. Mangler
> Internet: andy_bach at wiwb.uscourts.gov    
> VOICE: (608) 261-5738  FAX 264-5932
> 
> Contrariwise," continued Tweedledee, "if it was so, it might be, and
> if it were so, it would be; but as it isn't, it ain't.  That's logic!"
>               -- Lewis Carroll, "Through the Looking Glass"
>  
> 
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
> 
> 



-- 
Leland Johnson
http://protoplasmic.org


More information about the Chicago-talk mailing list