| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| To: | cygwin AT cygwin DOT com |
| From: | Matthew Woehlke <mw_triad AT users DOT sourceforge DOT net> |
| Subject: | Re: find(1) behaving strange or do I miss something |
| Date: | Tue, 10 Jul 2007 16:22:40 -0500 |
| Lines: | 27 |
| Message-ID: | <f70tb0$9vb$1@sea.gmane.org> |
| References: | <3058f9b40707101411r3e2b5b07t5419ec901d83e805 AT mail DOT gmail DOT com> |
| Mime-Version: | 1.0 |
| User-Agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.4.0 |
| In-Reply-To: | <3058f9b40707101411r3e2b5b07t5419ec901d83e805@mail.gmail.com> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
Ariel Burbaickij wrote:
> Hello all,
> following situation:
> I hate white spaces in file and cranked tiny bashscript for replacing
> them that goes like this:
> for i in `find . -type f`
> do
> mv $i /some_directory/`echo $i|sed 's/ /_/g'`
> done
>
> On this I get complaints from mv that it cannot find files that are
> basically parts of the
> name with spaces like this:
> [snip]
Not that this has anything to do with Cygwin, but...
well, yes, because bash is splitting at whitespace :-).
You probably want something like this:
find <args> | while read i ; do mv "$i" "${i// /_}" ; done
(note that "$i" must be quoted also!)
--
Matthew
"What is a release plan, anyway?" -- Oswald Buddenhagen
...who I'm sure did not mean it seriously ;-)
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |