From owner-freebsd-questions@FreeBSD.ORG Thu Dec 17 03:20:46 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66E701065679 for ; Thu, 17 Dec 2009 03:20:46 +0000 (UTC) (envelope-from martin@dc.cis.okstate.edu) Received: from dc.cis.okstate.edu (dc.cis.okstate.edu [139.78.103.93]) by mx1.freebsd.org (Postfix) with ESMTP id 3AA438FC1B for ; Thu, 17 Dec 2009 03:20:45 +0000 (UTC) Received: from dc.cis.okstate.edu (localhost.cis.okstate.edu [127.0.0.1]) by dc.cis.okstate.edu (8.14.2/8.13.8) with ESMTP id nBH3KatB081365 for ; Wed, 16 Dec 2009 21:20:43 -0600 (CST) (envelope-from martin@dc.cis.okstate.edu) Message-Id: <200912170320.nBH3KatB081365@dc.cis.okstate.edu> To: freebsd-questions@freebsd.org Date: Wed, 16 Dec 2009 21:20:34 -0600 From: Martin McCormick Subject: Re: sed -f Script Syntax X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2009 03:20:46 -0000 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