Date: Wed, 31 Jul 2002 18:58:49 -0400 (EDT) From: John Bleichert <syborg@stny.rr.com> To: freebsd-questions@freebsd.org Subject: Re: files to files with .txt Message-ID: <Pine.LNX.4.44.0207311856570.4091-100000@janeway.vonbek.dhs.org> In-Reply-To: <20020731230256.A19666@pirx.9lo.lublin.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <rodion@pirx.9lo.lublin.pl>
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0207311856570.4091-100000>
