Re: [eug-lug]renaming

2003-12-05 Thread Ben Barrett
which rename|xargs file

would be an easy way to tell which you have, BTW...

cheers,

   Ben


On Fri, 5 Dec 2003 11:32:23 -0800
Cory Petkovsek <[EMAIL PROTECTED]> wrote:

| On Fri, Dec 05, 2003 at 10:08:20AM -0800, Bob Miller wrote:
| > Dirk Ouellette wrote:
| > 
| > >  noartist]# ls notitle
| > > _10.mp3  _13.mp3  _16.mp3  _19.mp3  _22.mp3  _25.mp3  _28.mp3  _3.mp3 
| > > _6.mp3  _9.mp3
| > > _11.mp3  _14.mp3  _17.mp3  _20.mp3  _23.mp3  _26.mp3  _29.mp3  _4.mp3 
| > > _7.mp3  track00.mp3
| > > _12.mp3  _15.mp3  _18.mp3  _21.mp3  _24.mp3  _27.mp3  _2.mp3   _5.mp3 
| > > _8.mp3
| > > 
| > > What is the #rename command to rename all of these files with
| > > section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?
| > 
| > This would work.
| > 
| > cd noartist/notitle
| > rename _ section_ *.mp3
| > 
| > I don't know where the rename command came from (it's not part of
| > classical Unix), but it's in util-linux now, distributed by
| > kernel.org.
| 
| There are actually two rename commands that I've seen.  In debian,
| rename is a perl script which takes a perl substitution.  Your command
| would be:
| 
| rename 's/_/section_/g' *.mp3
| 
| In gentoo and perhaps other distributions you might have a binary rename
| which takes the format bob described above:
| 
| rename _ section_ *.mp3
| 
| Cory
| 
___
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug


Re: [eug-lug]renaming

2003-12-05 Thread Cory Petkovsek
On Fri, Dec 05, 2003 at 10:08:20AM -0800, Bob Miller wrote:
> Dirk Ouellette wrote:
> 
> >  noartist]# ls notitle
> > _10.mp3  _13.mp3  _16.mp3  _19.mp3  _22.mp3  _25.mp3  _28.mp3  _3.mp3 
> > _6.mp3  _9.mp3
> > _11.mp3  _14.mp3  _17.mp3  _20.mp3  _23.mp3  _26.mp3  _29.mp3  _4.mp3 
> > _7.mp3  track00.mp3
> > _12.mp3  _15.mp3  _18.mp3  _21.mp3  _24.mp3  _27.mp3  _2.mp3   _5.mp3 
> > _8.mp3
> > 
> > What is the #rename command to rename all of these files with
> > section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?
> 
> This would work.
> 
>   cd noartist/notitle
>   rename _ section_ *.mp3
> 
> I don't know where the rename command came from (it's not part of
> classical Unix), but it's in util-linux now, distributed by
> kernel.org.

There are actually two rename commands that I've seen.  In debian,
rename is a perl script which takes a perl substitution.  Your command
would be:

rename 's/_/section_/g' *.mp3

In gentoo and perhaps other distributions you might have a binary rename
which takes the format bob described above:

rename _ section_ *.mp3

Cory

-- 
Cory Petkovsek   Adapting Information
Adaptable IT ConsultingTechnology to your   
(541) 914-8417   business
[EMAIL PROTECTED]  www.AdaptableIT.com
___
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug


Re: [eug-lug]renaming

2003-12-05 Thread Bob Miller
Dirk Ouellette wrote:

>  noartist]# ls notitle
> _10.mp3  _13.mp3  _16.mp3  _19.mp3  _22.mp3  _25.mp3  _28.mp3  _3.mp3 
> _6.mp3  _9.mp3
> _11.mp3  _14.mp3  _17.mp3  _20.mp3  _23.mp3  _26.mp3  _29.mp3  _4.mp3 
> _7.mp3  track00.mp3
> _12.mp3  _15.mp3  _18.mp3  _21.mp3  _24.mp3  _27.mp3  _2.mp3   _5.mp3 
> _8.mp3
> 
> What is the #rename command to rename all of these files with
> section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?

This would work.

cd noartist/notitle
rename _ section_ *.mp3

I don't know where the rename command came from (it's not part of
classical Unix), but it's in util-linux now, distributed by
kernel.org.

-- 
Bob Miller  K
kbobsoft software consulting
http://kbobsoft.com [EMAIL PROTECTED]
___
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug


Re: [eug-lug]renaming

2003-12-05 Thread Rob Hudson
There is a perl rename script that allows you to do something like:
# ren 's/^_/section/' *.mp3

I keep it in my bin directory.  You can name it 'ren', or 'rename', or
whatever.  I'll attach it.

-Rob

> What is the #rename command to rename all of these files with
> section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?
> I've been told this before but I wiped my email files and man page is a
> bit obscure.
> Thanks
#!/usr/bin/perl

#Usage: ren perlexpr [files]

($op = shift) or die "Usage: ren perlexpr [filenames]\n";

if ([EMAIL PROTECTED]) {
  @ARGV = ;
  chop(@ARGV);
}

for (@ARGV) {
  $was = $_;
  eval $op;
  die $@ if $@;
  unless ($was eq $_) {
rename($was,$_) or die "Unable to rename $was: $!\n";
  }
}

=head1 NAME

B - use a perl expression to rename multiple files

=head1 SYNOPSIS

B perl_expression [files]

=head1 DESCRIPTION

B uses a perl expression to rename multiple files.  For more information about
perl expressions, consult the perl man pages, F by Randal
Schwartz, F by Larry Wall, or your local friendly
Perl programmer.

For example, to rename all files foo.* to bar.*, use

  ren 's/foo/bar/;' foo.*


=head1 AUTHORS

Randal Schwartz, Larry Wall

=head1 DATE

October 11, 1996

=cut

___
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug


Re: [eug-lug]renaming

2003-12-05 Thread John Sechrest

I would end up doing a for loop something like this:


foreach i ( *mp3)
mv $i section$i
echo $i
end


But you must have something else in mind.




Dirk Ouellette <[EMAIL PROTECTED]> writes:

 %  noartist]# ls notitle
 % _10.mp3  _13.mp3  _16.mp3  _19.mp3  _22.mp3  _25.mp3  _28.mp3  _3.mp3 
 % _6.mp3  _9.mp3
 % _11.mp3  _14.mp3  _17.mp3  _20.mp3  _23.mp3  _26.mp3  _29.mp3  _4.mp3 
 % _7.mp3  track00.mp3
 % _12.mp3  _15.mp3  _18.mp3  _21.mp3  _24.mp3  _27.mp3  _2.mp3   _5.mp3 
 % _8.mp3
 % 
 % What is the #rename command to rename all of these files with
 % section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?
 % I've been told this before but I wiped my email files and man page is a
 % bit obscure.
 % Thanks
 % 
 % ___
 % EuG-LUG mailing list
 % [EMAIL PROTECTED]
 % http://mailman.efn.org/cgi-bin/listinfo/eug-lug

-
John Sechrest  . Helping people use
.   computers and the Internet
  .more effectively
 .  
 .   Internet: [EMAIL PROTECTED]
  .   
  . http://www.peak.org/~sechrest
___
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug


[eug-lug]renaming

2003-12-04 Thread Dirk Ouellette
 noartist]# ls notitle
_10.mp3  _13.mp3  _16.mp3  _19.mp3  _22.mp3  _25.mp3  _28.mp3  _3.mp3 
_6.mp3  _9.mp3
_11.mp3  _14.mp3  _17.mp3  _20.mp3  _23.mp3  _26.mp3  _29.mp3  _4.mp3 
_7.mp3  track00.mp3
_12.mp3  _15.mp3  _18.mp3  _21.mp3  _24.mp3  _27.mp3  _2.mp3   _5.mp3 
_8.mp3

What is the #rename command to rename all of these files with
section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?
I've been told this before but I wiped my email files and man page is a
bit obscure.
Thanks

___
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug