how to fix a unix shell script to work on linux

Darrin Chandler dwchandler at stilyagin.com
Sat Jan 12 20:09:12 MST 2008


On Sat, Jan 12, 2008 at 07:09:16PM -0700, Josef Lowder wrote:
> .
> The following script used to work on my old unix system, 
> to remove blank lines from a text file.  It no longer works 
> on linux, but now it gives an error message (below): 
> 
> sed '/[!-~]/!d' $1
> 
> 
> This is the error message:
> 
> sed: -e expression #1, char 7: Invalid range end

I pasted it exactly as shown above and it worked flawlessly on my
OpenBSD system.

> How can I fix this?

I guess installing OpenBSD isn't the answer you're looking for... ;-)

As the other poster suggested, you can try something else. This may be
the same answer as he gave, but I can't be bothered to go look, but I
CAN be bothered to test it (and it works [again, on OpenBSD. try your
own system]):

sed '/^$/d' $1

-- 
Darrin Chandler            |  Phoenix BSD User Group  |  MetaBUG
dwchandler at stilyagin.com   |  http://phxbug.org/      |  http://metabug.org/
http://www.stilyagin.com/  |  Daemons in the Desert   |  Global BUG Federation


More information about the PLUG-discuss mailing list