From owner-freebsd-questions@FreeBSD.ORG Thu Jan 10 05:35:26 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 38A6F716 for ; Thu, 10 Jan 2013 05:35:26 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id EEC4D2FB for ; Thu, 10 Jan 2013 05:35:25 +0000 (UTC) Received: from smtp.fisglobal.com ([10.132.206.31]) by ltcfislmsgpa02.fnfis.com (8.14.5/8.14.5) with ESMTP id r0A5ZOTp016172 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Wed, 9 Jan 2013 23:35:24 -0600 Received: from [10.0.0.102] (10.14.152.61) by smtp.fisglobal.com (10.132.206.31) with Microsoft SMTP Server (TLS) id 14.2.309.2; Wed, 9 Jan 2013 23:35:23 -0600 Subject: Re: Renaming files MIME-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset="us-ascii" From: Devin Teske In-Reply-To: Date: Wed, 9 Jan 2013 21:35:22 -0800 Content-Transfer-Encoding: quoted-printable Message-ID: <8F132714-16C2-4E8C-8451-0E316D0E2D87@fisglobal.com> References: To: Odhiambo Washington X-Mailer: Apple Mail (2.1283) X-Originating-IP: [10.14.152.61] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.9.8327, 1.0.431, 0.0.0000 definitions=2013-01-09_10:2013-01-09,2013-01-09,1970-01-01 signatures=0 Cc: User Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Devin Teske List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jan 2013 05:35:26 -0000 On Jan 9, 2013, at 9:29 PM, Odhiambo Washington wrote: > I have several files in this format: >=20 > rw-r--r-- 1 johndoe johndoe 20085 Jan 9 19:30 1357744249.26989.mbox= :2, > -rw-r--r-- 1 johndoe johndoe 24419 Jan 9 19:30 > 1357744250.26989.mbox:2, > -rw-r--r-- 1 johndoe johndoe 418 Jan 9 19:30 > 1357744251.26989.mbox:2, > -rw-r--r-- 1 johndoe johndoe 418 Jan 9 19:30 > 1357744252.26989.mbox:2, > -rw-r--r-- 1 johndoe johndoe 78426 Jan 9 19:30 > 1357744254.26989.mbox:2, > -rw-r--r-- 1 johndoe johndoe 2561 Jan 9 19:30 > 1357744255.26989.mbox:2, > -rw-r--r-- 1 johndoe johndoe 6971 Jan 9 19:30 > 1357744257.26989.mbox:2, > -rw-r--r-- 1 johndoe johndoe 11270 Jan 9 19:30 > 1357744259.26989.mbox:2, >=20 > I'd like to rename them so that the filenames are in the format below: >=20 > -rw------- 1 johndoe johndoe 197702 Jan 10 03:00 > 1357776052.V803I33939aM83469.mail.domain.me.net:2, > -rw------- 1 johndoe johndoe 14579 Jan 10 03:31 > 1357777873.V803I33939bM614733.mail.domain.me.net:2, > -rw------- 1 johndoe johndoe 29212 Jan 10 03:46 > 1357778798.V803I33939cM995892.mail.domain.me.net:2, > -rw------- 1 johndoe johndoe 2834 Jan 10 04:30 > 1357781421.V803I33939dM597872.mail.domain.me.net:2, > -rw------- 1 johndoe johndoe 10593 Jan 10 06:18 > 1357787890.V803I33939eM865700.mail.domain.me.net:2, > -rw------- 1 johndoe johndoe 43565 Jan 10 07:10 > 1357791044.V803I33939fM193189.mail.domain.me.net:2, > -rw------- 1 johndoe johndoe 15492 Jan 10 07:42 > 1357792926.V803I3393a0M601349.mail.domain.me.net:2, >=20 >=20 > The first part of the filename is unique, so I just need to substitute > 26989.mbox:2, with V803I33939aM83469.mail.domain.me.net:2, hoping there > will be no clash:( >=20 sh -c 'for file in *.26989.mbox:2; do mv $file ${file%%.*}.V803I33939aM8346= 9.mail.domain.me.net:2; done' --=20 Devin _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you.