From owner-freebsd-questions@FreeBSD.ORG Fri Mar 27 16:42:01 2009 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D73811065672 for ; Fri, 27 Mar 2009 16:42:01 +0000 (UTC) (envelope-from misha_78@hotmail.com) Received: from bay0-omc2-s26.bay0.hotmail.com (bay0-omc2-s26.bay0.hotmail.com [65.54.246.162]) by mx1.freebsd.org (Postfix) with ESMTP id BE80D8FC0A for ; Fri, 27 Mar 2009 16:42:01 +0000 (UTC) (envelope-from misha_78@hotmail.com) Received: from BAY102-W35 ([64.4.61.135]) by bay0-omc2-s26.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 27 Mar 2009 09:42:01 -0700 Message-ID: X-Originating-IP: [201.212.199.195] From: Ramiro Caso To: Date: Fri, 27 Mar 2009 13:42:01 -0300 Importance: Normal In-Reply-To: <49CC44AC.6010401@skytracker.ca> References: <20090324195751.GA20259@skytracker.ca> <49CC44AC.6010401@skytracker.ca> MIME-Version: 1.0 X-OriginalArrivalTime: 27 Mar 2009 16:42:01.0502 (UTC) FILETIME=[F3F92BE0:01C9AEFA] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: questions@freebsd.org Subject: RE: renaming many Chinese files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2009 16:42:02 -0000 > Date: Thu=2C 26 Mar 2009 23:14:52 -0400 > To: misha_78@hotmail.com > From: david+dated+1238555693.f4db0d@skytracker.ca > CC: questions@freebsd.org=3B david+dated+1238356671.fa5de5@skytracker.ca > Subject: Re: renaming many Chinese files >=20 > that worked fine. Thanks. Glad it did. And sorry for the top-posting before (kind of new at this) > > Just a very quick thought (the first that pops into my mind): you could > > see which are the western characters that appear in the names=2C and th= en > > use sed to substitute all non-matching characters with nothing=2C > > something like: > > > > for i in *.jpg=3B do b=3D"`echo $i | sed 's/[^CHAR_SET]//g'`"=3B mv $i = $b=3B done > > > > (without > > forgetting=2C obviously=2C to add . to the CHAR_SET=2C something like: > > [^a-zA-Z0-9.]=3B if you figure out a less clumsy way=2C please=2C share= !!) > > I'm guessing that the initial 'P123' is just an example=2C or this will > > horribly backfire. But I'm really=2C REALLY=2C taking a shot in the dar= k > > here... (if you already thought of this=2C and it just doesn't work=2C > > sorry for the useless pitch) > > > > > > =20 > >> Date: Tue=2C 24 Mar 2009 15:57:51 -0400 > >> To: questions@freebsd.org > >> From: david+dated+1238356671.fa5de5@skytracker.ca > >> CC:=20 > >> Subject: renaming many Chinese files > >> > >> I have hundreds of jpg images where each image is named P123****.jpg > >> where the **** are chinese characters. I can't open the file - it > >> has to be renamed before I can open it. Evening if I could open it > >> I don't want the Chinese part as the name. > >> > >> Each file starts with 3 or four western characters and then has 3 or > >> four chinese characters=2C before the western .jpg extension. > >> > >> I want to to test each filename character by character > >> to see if it is western=2C and then when the first Chinese Character i= s=20 > >> found=2C have it simply rename the file to the 3 or four western-chara= cter=20 > >> name + .jpg > >> > >> I can write most of the script but I don't know how to test for=20 > >> western and/or Chinese characters. > >> =20 > >> I could run a script that would simply rename all the files to=20 > >> a number in sequential order but I would rather use the existing > >> starting name of the file if possible. > >> > >> _______________________________________________ > >> freebsd-questions@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe=2C send any mail to "freebsd-questions-unsubscribe@free= bsd.org" > >> =20 > > > > _________________________________________________________________ > > Encontr=E1 el auto de tus sue=F1os en MSN=20 > > http://xml.mercadolibre.com.ar/org-img/msn/autos.html__________________= _____________________________ > > freebsd-questions@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe=2C send any mail to "freebsd-questions-unsubscribe@freeb= sd.org" > > > > =20 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe=2C send any mail to "freebsd-questions-unsubscribe@freebsd= .org" _________________________________________________________________ =BFQuer=E9s saber c=F3mo va a estar el clima ma=F1ana? Ingres=E1 ahora a MS= N http://tiempo.ar.msn.com/=