[IMGate] Re: Deleting all blank lines w/sed tip

2005-06-09 Thread Len Conrad

I ran into a Win32 sed issue today while trying to use the port of sed from:
http://unxutils.sourceforge.net/

While trying to delete all blank lines in a file with the following cmd:

 sed /^$/d file

it refused to work.

But super-sed from: http://www.student.northpark.edu/pemente/sed/
works perfectly using the above cmd line.

probably just a syntax.

sed /^$/d file

... doesn't look valid at all.  eg, why double quote the de-limited 
regex's? I never do that.

google a sed tutorial or examples

Len




[IMGate] Re: Deleting all blank lines w/sed tip

2005-06-09 Thread NeoBlu
sed /^$/d file
... doesn't look valid at all.  eg, why double quote the de-limited
regex's? I never do that.

That would be true on *nix. But when calling a batch file on Win2k (any
Win32 OS, I think) you need the quotes. At least I have never been able to
get it to work without them.

-NB




[IMGate] Re: Deleting all blank lines w/sed tip

2005-06-09 Thread Len Conrad

 sed /^$/d file
 ... doesn't look valid at all.  eg, why double quote the de-limited
 regex's? I never do that.

That would be true on *nix. But when calling a batch file on Win2k (any
Win32 OS, I think) you need the quotes. At least I have never been able to
get it to work without them.


ok, I normally use sed for replacement, not line deletion.  The Unix 
vertical tick doesn't work on windows sed.

This does:

sed -e /^$/d  blank_lines.txt  no_blank_lines.txt

here's one to delete lines which contains 0 or more blanks:

sed -e /^[ ]*$/d  blank_lines.txt  no_blank_lines.txt



Len