From owner-freebsd-questions@FreeBSD.ORG Wed Dec 16 16:36:47 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 39FB71065670 for ; Wed, 16 Dec 2009 16:36:47 +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 111EB8FC1E for ; Wed, 16 Dec 2009 16:36:46 +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 nBGGaebB018830 for ; Wed, 16 Dec 2009 10:36:43 -0600 (CST) (envelope-from martin@dc.cis.okstate.edu) Message-Id: <200912161636.nBGGaebB018830@dc.cis.okstate.edu> To: freebsd-questions@freebsd.org Date: Wed, 16 Dec 2009 10:36:40 -0600 From: Martin McCormick Subject: 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: Wed, 16 Dec 2009 16:36:47 -0000 If you have a sed script that is executable as in the first line starts with #! /usr/bin/sed -f and the following lines are like: /this repetitive line/d /and another repetitive line to go/d This all works great. You just make the file executable and use it as a filter if you want to remove any instance of those lines in text. How does one embed a command in this filter to make sed understand an extended or modern regular expression like: /part 1[[:space:]]text\/html[[:space:]]/d This is normally the -e flag but I haven't figured out how to put it in the script. I would like to either use it to make that one line show up as an extended regular expression or make sed run the entire script in the -e mode. In this particular case, I have made a 14-line script called nuisancefilter that vaporizes annoying blocks of text from Email messages. I have read the man page and it says that this is possible, but I never quite understood how to apply the commands to an executable sed script file. Many thanks. Martin McCormick WB5AGZ Stillwater, OK Systems Engineer OSU Information Technology Department Telecommunications Services Group