Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 2002 19:46:17 +0100
From:      Marc Perisa <marc@porsche.de>
To:        Dan Malaby <dan@peritek.com>
Cc:        questions@freebsd.org
Subject:   Re: OT: shell questions
Message-ID:  <AA993348-0C6F-11D7-BFE3-000A27AC3F98@porsche.de>
In-Reply-To: <5.1.0.14.2.20021210084343.00aa3228@pop3.peritek.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AA993348-0C6F-11D7-BFE3-000A27AC3F98>