| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| Message-ID: | <472C2918.EC6F830D@dessent.net> |
| Date: | Sat, 03 Nov 2007 00:54:00 -0700 |
| From: | Brian Dessent <brian AT dessent DOT net> |
| X-Mailer: | Mozilla 4.79 [en] (Windows NT 5.0; U) |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: rename file on cygwin |
| References: | <cf09ac7f0711022351i58c7a034p12f43f085abdfa04 AT mail DOT gmail DOT com> |
| X-IsSubscribed: | yes |
| Reply-To: | cygwin AT cygwin DOT com |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.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 |
Muhammad Najmi Ahmad Zabidi wrote:
> $ ls *.mp3*
> agama dan aqidah b DOT mp3 AT encid=U2FsdGVkX1-SGjIrW9vhJhh1Py
> -h2cpUXJWMQf1Bj04=
>
> Which I want to rename to this:
> $ ls *.mp3*|awk -F"@*" {'print $1'}
>
> agama dan aqidah b.mp3
>
> I tried to use "for" loop but since the old name contains spaces, I've
> to deal with the spaces as well.
Spaces are no problem as long as you quote arguments properly:
for F in *.mp3*; do
mv -v "$F" "$(echo "$F" | sed -e s,@.*,,)"
done
> I googled and found the solution of
> using "rename", and my cygwin contains this tool as well.
>
> rename.exe -n 's/.mp3*/.m3/' *.mp3*
That is referring to a different version of rename than what comes with
Cygwin. The Cygwin version is a much simplified version that cannot do
regexps, it is only a blind string replacement tool that has no such -n
(or any other named option.) It won't be of use to you in this case.
Brian
--
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 |