From owner-freebsd-questions Tue Dec 10 10:49:58 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 BCD9437B404 for ; Tue, 10 Dec 2002 10:49:56 -0800 (PST) Received: from gate21.fw.porsche.de (gate23.fw.porsche.de [193.174.9.99]) by mx1.FreeBSD.org (Postfix) with SMTP id 7E80843E4A for ; Tue, 10 Dec 2002 10:49:54 -0800 (PST) (envelope-from marc@porsche.de) Received: (qmail 8495 invoked from network); 10 Dec 2002 18:59:12 -0000 Received: from unknown (HELO wuxin011.ibd.porsche.de) (141.36.65.1) by 193.197.149.150 with SMTP; 10 Dec 2002 18:59:12 -0000 Received: (qmail 23839 invoked from network); 10 Dec 2002 18:49:51 -0000 Received: from darwinrz.zbk.porsche.de (141.36.179.17) by smtp4cli.ibd.porsche.de with SMTP; 10 Dec 2002 18:49:51 -0000 Date: Tue, 10 Dec 2002 19:46:17 +0100 Subject: Re: OT: shell questions Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) Cc: questions@freebsd.org To: Dan Malaby From: Marc Perisa In-Reply-To: <5.1.0.14.2.20021210084343.00aa3228@pop3.peritek.com> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.482) 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 Hi Dan, Am Dienstag den, 10. Dezember 2002, um 18:08, schrieb Dan Malaby: > I know this is off topic but this list does seem to have the most > knowledgeable people > for this kind of question. > > I have a 4.7 FBSD with samba running, so I get a lot of files with > unkosher names ie. > spaces in the name. So what I tried doing was to write a shell script > using sh that > located these files and changed the space to a underbar. > > I know that if I, from the keyboard, put quotes around the offending > name, that I can mv > the file to a new name. So I wrote a shell script using awk and sed to > make a file with > the offending names with quotes around them. Then I tried to feed this > into another > script that was going to do the actually mv. The problem was that the > shell script > that read the file still thought that the spaces in the file name were > separators, eventho > the names were quoted. So then I tried skipping making the extra file > and just used the > awk and sed to feed the for in statement. I know that the awk and sed > were working properly > because I can make a file with the file names quoted. That did did not > work either, I still kept > getting file not found because it still was seeing the space as a > seperator. > > Any help or pointers would be appreciated. please send the script in question that we might help you with it. Else try this (I tested it ...): ls | awk '{printf "mv \""$0"\" ";gsub(" ","_"); printf $0 " \n"}' | sh Hope that helps Marc To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message