Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Dec 2009 21:20:34 -0600
From:      Martin McCormick <martin@dc.cis.okstate.edu>
To:        freebsd-questions@freebsd.org
Subject:   Re: sed -f Script Syntax 
Message-ID:  <200912170320.nBH3KatB081365@dc.cis.okstate.edu>

next in thread | raw e-mail | index | archive | help
Warren Block writes:
> sed(1) says it should be -E. Looks like it will only work on the whole
> script.

	Many thanks. I have had -e work many times if you call
sed from either the command line or a shell script as in

sed -f somefile

with somefile being 1 or more lines of sed commands. When the
file itself is the script, the first line actually calls sed
from within the file. I was just wondering if the sed used in
freeBSD had a way to let one put the -e flag in there also. -ef
or -fe doesn't cut it:

sed: 1: "f
": invalid command code f

That was with sed -ef. If you try sed -fe, it bombs with the
same complaint only now it doesn't understand the e so there can
apparently be only one flag after the -.
#! /usr/bin/sed -f -e doesn't work either.

	Someone wrote me off list chiding me that this is not a
freebsd question. Well, I am running this under freebsd and
there are sometimes slight differences between bsd-style
commands and other flavors of Unix such as Linux. They are not
numerous, but try date -r1234567890 under freebsd. You get:

Fri Feb 13 17:31:30 CST 2009

Try that same command under Linux:

date: 1234567890: No such file or directory

That date command wants the string in a file to produce similar
results.

	ping -o under freebsd is incredibly useful when you want
to know when an interface comes up. Under Linux and earlier
versions of FreeBSD, it does nothing but tell you it didn't
understand -o. Again, thank you for answering.

Martin McCormick



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912170320.nBH3KatB081365>