From owner-freebsd-questions Wed Jul 31 15:57:50 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6742437B400 for ; Wed, 31 Jul 2002 15:57:47 -0700 (PDT) Received: from janeway.vonbek.dhs.org (bgm-24-24-79-198.stny.rr.com [24.24.79.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F42143E4A for ; Wed, 31 Jul 2002 15:57:46 -0700 (PDT) (envelope-from syborg@stny.rr.com) Received: by janeway.vonbek.dhs.org (Postfix, from userid 507) id 2B4924FC89; Wed, 31 Jul 2002 18:58:49 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by janeway.vonbek.dhs.org (Postfix) with ESMTP id 25EC04A0D for ; Wed, 31 Jul 2002 18:58:49 -0400 (EDT) Date: Wed, 31 Jul 2002 18:58:49 -0400 (EDT) From: John Bleichert X-X-Sender: syborg@janeway.vonbek.dhs.org Reply-To: John Bleichert To: freebsd-questions@freebsd.org Subject: Re: files to files with .txt In-Reply-To: <20020731230256.A19666@pirx.9lo.lublin.pl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Here's a small, entry-level perl script: #!/usr/bin/perl @listing = `ls`; # in dir with the files foreach $i ( @listing ) { chomp($i); system("mv $i $i.txt"); } You'll need to modify it so it doesn't rename itself, if run from the same directory. All those 'system' calls may be expensive, though, this may be a call for sed/awk ;-) On Wed, 31 Jul 2002, Maciej Szewczyk wrote: > Date: Wed, 31 Jul 2002 23:02:56 +0200 > From: Maciej Szewczyk > To: questions@FreeBSD.ORG > Subject: files to files with .txt > > Hi, > I have about 1000 files. > ls -1 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > ... > ... > 998 > 999 > 1000 > And now I must have 1000 files with .txt -> > ls -1 > 1.txt > 2.txt > 3.txt > ... > ... > 998.txt > 999.txt > 1000.txt > > How can I do that. > Tahnks for help. > > Maciej Szewczyk > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > /* * John Bleichert * syborg@stny.rr.com * http://vonbek.dhs.org/latest.jpg */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message