From owner-freebsd-questions@FreeBSD.ORG Fri May 12 18:38:55 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B8BA16B57E for ; Fri, 12 May 2006 18:38:55 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.FreeBSD.org (Postfix) with ESMTP id AEF4343D62 for ; Fri, 12 May 2006 18:38:51 +0000 (GMT) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.13.4/8.13.3) with ESMTP id k4CIcgIg016395; Fri, 12 May 2006 12:38:42 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.13.4/8.13.3/Submit) with ESMTP id k4CIcgJf016392; Fri, 12 May 2006 12:38:42 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Fri, 12 May 2006 12:38:42 -0600 (MDT) From: Warren Block To: Giorgos Keramidas In-Reply-To: <20060512170406.GE26040@gothmog.pc> Message-ID: <20060512122847.F16342@wonkity.com> References: <200605121450.k4CEokhn022089@dc.cis.okstate.edu> <20060512150608.GB25497@gothmog.pc> <20060512102134.J14220@wonkity.com> <20060512170406.GE26040@gothmog.pc> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (wonkity.com [127.0.0.1]); Fri, 12 May 2006 12:38:42 -0600 (MDT) Cc: Martin McCormick , freebsd-questions@freebsd.org Subject: Re: Trimming Whitespace From Beginning and end of Text Lines 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: Fri, 12 May 2006 18:38:58 -0000 On Fri, 12 May 2006, Giorgos Keramidas wrote: >> The first sed expression is missing "//". Correcting that: >> sed -i -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' test.txt >> sed: lstat: No such file or directory > > Yeah, I noticed the missing // in the first regexp, but only > after I had posted the message. You're right, of course :) > > It seems odd that the fixed expression doesn't work though. > Which version of FreeBSD is this and what sed are you running? > > $ uname -v FreeBSD 4.11-STABLE #0: Wed Mar 22 19:18:33 MST 2006 > $ type sed That's a sh-ism (normally I use csh): sed is /usr/bin/sed Interestingly, the problem is different on 6.1 (csh or sh): sed -i -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' test.txt sed: -e: No such file or directory ...which is solved by giving a blank argument for -i: sed -i'' -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' test.txt Gah. -Warren Block * Rapid City, South Dakota USA