From owner-freebsd-questions@FreeBSD.ORG Thu Jan 29 06:24:10 2004 Return-Path: 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 1C7A416A4CE for ; Thu, 29 Jan 2004 06:24:10 -0800 (PST) Received: from hotmail.com (law11-f18.law11.hotmail.com [64.4.17.18]) by mx1.FreeBSD.org (Postfix) with ESMTP id 971B543D3F for ; Thu, 29 Jan 2004 06:24:08 -0800 (PST) (envelope-from weiwuzhang@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 29 Jan 2004 06:24:08 -0800 Received: from 211.98.230.113 by lw11fd.law11.hotmail.msn.com with HTTP; Thu, 29 Jan 2004 14:24:08 GMT X-Originating-IP: [211.98.230.113] X-Originating-Email: [weiwuzhang@hotmail.com] X-Sender: weiwuzhang@hotmail.com From: "Zhang Weiwu" To: questions@freebsd.org Date: Thu, 29 Jan 2004 22:24:08 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312; format=flowed Message-ID: X-OriginalArrivalTime: 29 Jan 2004 14:24:08.0484 (UTC) FILETIME=[8E9DCE40:01C3E673] Subject: use \000 in sed X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: zhangweiwu@realss.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2004 14:24:10 -0000 Hello. I wish to see all the files in some pathes in a string. Say, I wish to list all files in $PATH and manpath(1) What I can think of is to use #manpath | sed "s/:/ /g" |xargs ls (This is useful when auto-completing man command in a shell, say, csh). This works, but the command is wrong when a path contain a space in it. I think a better way is to replace ":" with \000, the "NULL". In this way I can use "xargs -0" to pass all pathes to ls(1) #manpath | sed s/:/\000/g" |xargs -0 ls Only I don't know how to let sed(1) understand \000 is the actual ascii code 0 not the string "000". Any hints? Thank you very much. _________________________________________________________________ 享用世界上最大的电子邮件系统— MSN Hotmail。 http://www.hotmail.com