From owner-freebsd-questions@FreeBSD.ORG Tue Apr 13 03:29:18 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 2673E16A4CE for ; Tue, 13 Apr 2004 03:29:18 -0700 (PDT) Received: from dyer.circlesquared.com (host217-45-219-83.in-addr.btopenworld.com [217.45.219.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC8FB43D53 for ; Tue, 13 Apr 2004 03:29:09 -0700 (PDT) (envelope-from peter@circlesquared.com) Received: from circlesquared.com (localhost.petanna.net [127.0.0.1]) i3DAXTdu051578 for ; Tue, 13 Apr 2004 11:33:41 +0100 (BST) (envelope-from peter@circlesquared.com) Message-ID: <407BC1F9.4050305@circlesquared.com> Date: Tue, 13 Apr 2004 11:33:29 +0100 From: Peter Risdon User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7b) Gecko/20040327 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD Question List References: <40757879.1010307@circlesquared.com> <20040408165511.GD8182@dan.emsphone.com> In-Reply-To: <20040408165511.GD8182@dan.emsphone.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Problems with filename with spaces (was Pipes and commands thatrequire two arguments) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2004 10:29:18 -0000 Thanks very much for the previous help - I missed the example in man xargs. The files I am trying to manipulate include spaces in the file names, and I cannot seem to escape them effectively. If I try something like: #find /usr/home -name *.rtf.exe -print0 | perl -p -e 's/\ /\\\ /g;' | xargs -0 -J % mv % /usr/newplace/ Then although all spaces are preceded by backslashes I get errors every time a space is encountered. So for a file at /usr/home/user/this is a file.rtf.exe I get file does not exist errors from mv at: /usr/home/user/this\ and at: is\ and at: a\ and at: file.rtf.exe (yes, a windows virus on a network share has been busy). I have also tried #find /usr/home -name *.rtf.exe -print0 | perl -p -e 's/\ /\\\ /g;' > listofdodgyfiles and the list is fine. If I paste a line into mv on the command line, it works. If I use a simple script to read the file, same errors as mentioned above. I'm sure I'm missing something obvious... Any nudges in the right direction would be gratefully received. PWR.