From owner-freebsd-questions Thu Nov 7 13:23:51 2002 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 5AE4F37B401 for ; Thu, 7 Nov 2002 13:23:50 -0800 (PST) Received: from the-frontier.org (ns1.the-frontier.org [216.86.199.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 69B1443E6E for ; Thu, 7 Nov 2002 13:23:49 -0800 (PST) (envelope-from pscott@skycoast.us) Received: from [192.168.66.249] (dhcp-249-66-168-192.the-frontier.org [192.168.66.249]) by the-frontier.org (8.9.3/8.9.3) with ESMTP id NAA98375; Thu, 7 Nov 2002 13:23:14 -0800 (PST) (envelope-from pscott@skycoast.us) User-Agent: Microsoft-Entourage/10.0.0.1309 Date: Thu, 07 Nov 2002 13:23:13 -0800 Subject: Re: stupid sed question From: "Paul A. Scott" To: Miguel Mendez , Mathew Kanner Cc: Message-ID: In-Reply-To: <20021107221324.6d9f92bd.flynn@energyhq.homeip.net> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > How about echo abc | tr 'b' '\n' ? tr substitutes characters only, while sed can work on arbitrary strings and patterns. My guess is that the example was a simplified expression of a more general requirement, in which case sed is appropriate and therefore, echo aaabbbccc | sed -e 's,bbb,\ ,' will yield aaa ccc as expected, while tr would give aaa ccc which is almost certainly not wanted. (Reminder: you need \\ if typing directly on the command line, or a single \ if entered in a script.) Paul A. Scott mailto:pscott@skycoast.us http://skycoast.us/pscott/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message