-f <empty file> doesn't work in SunOS version of sed

Roger Rohrbach decwrl!sun!wrs!wrs.UUCP!roger at ucbvax.berkeley.edu
Sat Jun 10 07:42:34 AEST 1989


This is a warning to hapless users of sed(1).

The "-f" option to sed does not behave in the same way in SunOS as it does
in most other Unix implementations, to wit: if the file containing the
script is empty, sed either mistakes its first input file name for a
script, or produces no output, according as it is invoked with or without
a filename parameter, respectively.  This misbehavior is demonstrated
below, where the output of the 4.3BSD and SunOS 4.0 versions of sed is
compared:

This bug affects, e.g., shell programs that build up temporary sed
scripts, which may possibly be null, for use as filters.

---
4.3BSD sed -f output:

% head /usr/dict/words > WORDS
% sed -f /dev/null WORDS
a
AAA
AAAS
Aarhus
Aaron
ABA
Ababa
aback
abacus
abalone
% cat WORDS | sed -f /dev/null
a
AAA
AAAS
Aarhus
Aaron
ABA
Ababa
aback
abacus
abalone
%

---
SunOS4.0 sed -f output:

% sed -f /dev/null WORDS
sed: Unrecognized command: WORDS
% cat WORDS | sed -f /dev/null
%
-- 
Roger Rohrbach                              sun!wrs!roger    roger at wrs.sun.com
.- Eddie sez: ----------------------------------------------- (c) 1986, 1989 -.
|   {o >o                                                                     |
|    \<>) "People call me rude. I wish we all were nude."                     |



More information about the Comp.sys.sun mailing list