[plug] perl program to strip blank lines from a file

Ryan ryan at is.as.geeky.as
Mon May 17 15:44:18 WST 2004


On Mon, 2004-05-17 at 15:36, David Buddrige wrote:
> Hi all, 
> 
> I am tryin to put together a program which will strip blank lines out of a 
> text file.  To this end, I have written the following perl program; but it 
> doesn't seem to work... can anyone see why?  To my mind, the regex ^$ should 
> match lines that have no content, but this does not seem to be so... 

If they have no content, they will contain at the very least a new line
character.  hexdump -c on the file will show you the escape characters
at the appropriate spots.  It may be a simple \n or  \r\n for DOS files
(from memory).

Ryan




More information about the plug mailing list