Re: basic issue/question -- renaming in mass a bunch of files

2018-02-25 Thread Tom H
On Sat, Feb 24, 2018 at 6:12 PM, Patrick O'Callaghan
 wrote:
> On Sat, 2018-02-24 at 23:40 +0100, Wolfgang Pfeiffer wrote:
>> On Sat, 24 Feb 2018 13:14:49 -0500
>> Tom H  wrote:
>>>
>>> Is "rename" provided by util-linux or is it a perl-provided script?
>>>
>>> The util-linux syntax is
>>>
>>> rename search_for replace_with 
>>>
>>> while the perl-script syntax is
>>>
>>> rename 's/search_for/replace_with/' 
>>
>> thanks for the latter sed syntax - good to know on Debian, IINM ...
>
> I wonder if that version is actually prename ('dnf install prename')
> under a different name, which would be nicely ironic ...

prename! Yes, thanks.

It's also rejigged my memory that previous versions of Debian had
"prename". It was provided by "perl" itself and it was the same as
Fedora's "prename". There was an alternatives-created "rename" symlink
to it.

Looking at the control and spec files,

Fedora's rename comes from

http://search.cpan.org/~pederst/rename-1.9/bin/rename.PL

Debian's rename comes from

http://search.cpan.org/~rmbarker/File-Rename-0.20/lib/File/Rename.pm
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-25 Thread Tom H
On Sat, Feb 24, 2018 at 5:40 PM, Wolfgang Pfeiffer  wrote:
> On Sat, 24 Feb 2018 13:14:49 -0500
> Tom H  wrote:
>> On Sat, Feb 24, 2018 at 9:03 AM, bruce  wrote:
>>>
>>> Have a bunch of files with the basic naming of:
>>> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
>>> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
>>> etc..
>>>
>>> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
>>> files, renaming the files to the rest of the filename..
>>>
>>> Thought it should be simple using rename
>>>
>>> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
>>>
>>> However, this didn't work... so.. hmm..
>>
>> Is "rename" provided by util-linux or is it a perl-provided script?
>>
>> The util-linux syntax is
>>
>> rename search_for replace_with 
>>
>> while the perl-script syntax is
>>
>> rename 's/search_for/replace_with/' 
>
> thanks for the latter sed syntax - good to know on Debian, IINM ...

You're welcome.

The perl syntax isn't Debian-specific; I've used it on Fedora or RHEL
but I can't remember whether it'd been installed with yum (and what
the package might've been) or installed independently of the packaging
system.

On Debian, util-linux is installed by default. It brings in
"rename.ul" and the alternatives system's used to create a "rename"
symlink to it. If you then install "rename", it brings in
"file-rename" and the alternatives system is used to switch the
"rename" symlink to it.

Different strokes for different distros...
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Wolfgang Pfeiffer
On Sun, 25 Feb 2018 04:21:24 +0100
Wolfgang Pfeiffer  wrote:

> Only a tldr:
> Both Debian and Fedora have the simple rename utility that is usable
> without perl knowledge.
> Only Fedora actually seems to have the extended version of Larry Walls

"Only Fedora": No idea whether the extended version is on other OS's
available - I simply didn't find it on Debian  ...  

> rename, namely prename, which was done by Peder Stray. While prename
> utilities  on Debian, that I found *so far*, seem to be renamed (sic! ... :) 
> versions of Larry Wall's rename. 
> 
> HTH



-- 
Wolfgang Pfeiffer
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Wolfgang Pfeiffer
On Sat, 24 Feb 2018 19:48:23 -0500
Todd Zullinger  wrote:

> Patrick O'Callaghan wrote:
> > I wonder if that version is actually prename ('dnf install prename')
> > under a different name, which would be nicely ironic ...  
> 
> Heh.  I think they're different.  I'm not a Debian user
> though, so I could be way off on what follows. :)
> 
> This gets quite messy.  The /usr/bin/rename command is
> managed by alternatives in Debian.  The default for rename
> in a docker container of Debian 8 is file-rename.

Only a tldr:
Both Debian and Fedora have the simple rename utility that is usable
without perl knowledge.
Only Fedora actually seems to have the extended version of Larry Walls
rename, namely prename, which was done by Peder Stray. While prename
utilities  on Debian, that I found *so far*, seem to be renamed (sic! ... :) 
versions of Larry Wall's rename. 

HTH
-- 
Wolfgang Pfeiffer
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Stephen Morris

On 25/2/18 1:03 am, bruce wrote:

Hi.

Have a bunch of files with the basic naming of:
ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
etc..

I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
files, renaming the files to the rest of the filename..

Thought it should be simple using rename

rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat

However, this didn't work... so.. hmm..

How would you guys solve this?

SO has a bunch of different solns as well.

thanks...


Just some info on this,   rename 'ztcloud_nfs_parsezt' '' zt*.dat will 
remove the required first part from the file names.



regards,

Steve



___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org

___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Todd Zullinger
Patrick O'Callaghan wrote:
> I wonder if that version is actually prename ('dnf install prename')
> under a different name, which would be nicely ironic ...

Heh.  I think they're different.  I'm not a Debian user
though, so I could be way off on what follows. :)

This gets quite messy.  The /usr/bin/rename command is
managed by alternatives in Debian.  The default for rename
in a docker container of Debian 8 is file-rename.

The file-rename command comes from the rename package.  It's
installed as file-rename rather than rename based on this
commit:

https://salsa.debian.org/perl-team/modules/packages/rename/commit/642262b4

The source of the Debian rename package is the perl
File::Rename module, here:

https://metacpan.org/release/File-Rename

The Fedora prename package points to:

http://search.cpan.org/dist/rename/

That's a different perl rename tool (since you can never
have too many rename tools, obviously).  Debian ships
prename as well.  It's in the rename alternatives group.

Debian also ships the util-linux rename as rename.ul, but it
doesn't seem to be in the alternatives group for rename.

Clearly, using the command in a script would be insane, as
you'd have more lines of code to determine which version you
were using than it would take to just rename the files using
whatever language the script was written in. :)

-- 
Todd
~~
A diplomat is a person who can tell you to go to Hell in such a way
that you actually look forward to the trip.
-- Anonymous



signature.asc
Description: PGP signature
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Patrick O'Callaghan
On Sat, 2018-02-24 at 23:40 +0100, Wolfgang Pfeiffer wrote:
> On Sat, 24 Feb 2018 13:14:49 -0500
> Tom H  wrote:
> 
> > On Sat, Feb 24, 2018 at 9:03 AM, bruce  wrote:
> > > 
> > > Have a bunch of files with the basic naming of:
> > > ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> > > ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> > > etc..
> > > 
> > > I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> > > files, renaming the files to the rest of the filename..
> > > 
> > > Thought it should be simple using rename
> > > 
> > > rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> > > 
> > > However, this didn't work... so.. hmm..  
> > 
> > Is "rename" provided by util-linux or is it a perl-provided script?
> > 
> > The util-linux syntax is
> > 
> > rename search_for replace_with 
> > 
> > while the perl-script syntax is
> > 
> > rename 's/search_for/replace_with/' 
> 
> thanks for the latter sed syntax - good to know on Debian, IINM ...

I wonder if that version is actually prename ('dnf install prename')
under a different name, which would be nicely ironic ...

poc
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Wolfgang Pfeiffer
On Sat, 24 Feb 2018 13:14:49 -0500
Tom H  wrote:

> On Sat, Feb 24, 2018 at 9:03 AM, bruce  wrote:
> >
> > Have a bunch of files with the basic naming of:
> > ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> > ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> > etc..
> >
> > I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> > files, renaming the files to the rest of the filename..
> >
> > Thought it should be simple using rename
> >
> > rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> >
> > However, this didn't work... so.. hmm..  
> 
> Is "rename" provided by util-linux or is it a perl-provided script?
> 
> The util-linux syntax is
> 
> rename search_for replace_with 
> 
> while the perl-script syntax is
> 
> rename 's/search_for/replace_with/' 

thanks for the latter sed syntax - good to know on Debian, IINM ...

And this: a modern nautilus now does batch renaming of
files/folders, it seems ...

Regards,
-- 
Wolfgang Pfeiffer
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Patrick O'Callaghan
On Sat, 2018-02-24 at 09:41 -0900, Fred Erickson wrote:
> On Sat, 24 Feb 2018 18:02:39 +
> Patrick O'Callaghan  wrote:
> 
> ..snip
> > > 
> > > There appears to be 2 different "rename" programs out in the
> > > world.  The Fedora rename uses a text string for the pattern, but
> > > on my Mint box the pattern is a sed-like substitution.
> > > Confusing ?  
> > 
> > Since this is a Fedora list, that's the one I mean. Don't anything
> > about the Mint one. There are also other things like krename etc.
> > which are more flexible but harder to use (IMHO).
> > 
> > poc
> 
> There is a GUI tool called 'pyRenamer' that I use on F27 mainly for
> renaming photos that is very useful once you get it figured out.
> Especially if you have lots of files with lots of different name
> patterns. Shows what the change will be before you execute the change
> command. 

Yes. 'dnf search rename' throws up this and several others.

poc
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Fred Erickson
On Sat, 24 Feb 2018 18:02:39 +
Patrick O'Callaghan  wrote:

..snip
> > 
> > There appears to be 2 different "rename" programs out in the
> > world.  The Fedora rename uses a text string for the pattern, but
> > on my Mint box the pattern is a sed-like substitution.
> > Confusing ?  
> 
> Since this is a Fedora list, that's the one I mean. Don't anything
> about the Mint one. There are also other things like krename etc.
> which are more flexible but harder to use (IMHO).
> 
> poc

There is a GUI tool called 'pyRenamer' that I use on F27 mainly for
renaming photos that is very useful once you get it figured out.
Especially if you have lots of files with lots of different name
patterns. Shows what the change will be before you execute the change
command. 

Fred
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Tom H
On Sat, Feb 24, 2018 at 9:03 AM, bruce  wrote:
>
> Have a bunch of files with the basic naming of:
> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> etc..
>
> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> files, renaming the files to the rest of the filename..
>
> Thought it should be simple using rename
>
> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
>
> However, this didn't work... so.. hmm..

Is "rename" provided by util-linux or is it a perl-provided script?

The util-linux syntax is

rename search_for replace_with 

while the perl-script syntax is

rename 's/search_for/replace_with/' 
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Patrick O'Callaghan
On Sat, 2018-02-24 at 08:55 -0800, John Wendel wrote:
> On 02/24/2018 08:38 AM, Patrick O'Callaghan wrote:
> > On Sat, 2018-02-24 at 09:03 -0500, bruce wrote:
> > > Hi.
> > > 
> > > Have a bunch of files with the basic naming of:
> > > ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> > > ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> > > etc..
> > > 
> > > I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> > > files, renaming the files to the rest of the filename..
> > > 
> > > Thought it should be simple using rename
> > > 
> > > rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> > 
> > Read the man page again. The pattern is just a text string, not a regex
> > or sed-type command.
> > 
> > poc
> > ___
> > users mailing list -- users@lists.fedoraproject.org
> > To unsubscribe send an email to users-le...@lists.fedoraproject.org
> > 
> 
> 
> There appears to be 2 different "rename" programs out in the world.  The 
> Fedora rename uses a text string for the pattern, but on my Mint box the 
> pattern is a sed-like substitution.  Confusing ?

Since this is a Fedora list, that's the one I mean. Don't anything
about the Mint one. There are also other things like krename etc. which
are more flexible but harder to use (IMHO).

poc
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread John Wendel

On 02/24/2018 08:38 AM, Patrick O'Callaghan wrote:

On Sat, 2018-02-24 at 09:03 -0500, bruce wrote:

Hi.

Have a bunch of files with the basic naming of:
ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
etc..

I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
files, renaming the files to the rest of the filename..

Thought it should be simple using rename

rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat


Read the man page again. The pattern is just a text string, not a regex
or sed-type command.

poc
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org




There appears to be 2 different "rename" programs out in the world.  The 
Fedora rename uses a text string for the pattern, but on my Mint box the 
pattern is a sed-like substitution.  Confusing ?

___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Patrick O'Callaghan
On Sat, 2018-02-24 at 16:38 +, Patrick O'Callaghan wrote:
> On Sat, 2018-02-24 at 09:03 -0500, bruce wrote:
> > Hi.
> > 
> > Have a bunch of files with the basic naming of:
> > ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> > ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> > etc..
> > 
> > I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> > files, renaming the files to the rest of the filename..
> > 
> > Thought it should be simple using rename
> > 
> > rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> 
> Read the man page again. The pattern is just a text string, not a regex
> or sed-type command.

In fact the man page is very misleading as it uses the term
'expression' without any explanation. All the same, it is in fact only
a text string.

poc
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Patrick O'Callaghan
On Sat, 2018-02-24 at 09:03 -0500, bruce wrote:
> Hi.
> 
> Have a bunch of files with the basic naming of:
> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> etc..
> 
> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> files, renaming the files to the rest of the filename..
> 
> Thought it should be simple using rename
> 
> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat

Read the man page again. The pattern is just a text string, not a regex
or sed-type command.

poc
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Wolfgang Pfeiffer
On Sat, 24 Feb 2018 09:03:09 -0500
bruce  wrote:

> Hi.
> 
> Have a bunch of files with the basic naming of:
> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> etc..
> 
> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> files, renaming the files to the rest of the filename..
> 
> Thought it should be simple using rename
> 
> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> 
> However, this didn't work... so.. hmm..
> 
> How would you guys solve this?
> 
> SO has a bunch of different solns as well.
> 
> thanks...

This worked here with the F26 version of 'rename': it seems part of
the util-linux package here:

First a cold-run on the files you want to change with the "-n" switch.
Without changing anything:

% rename -nv 'ztcloud_nfs_parseztaa_1__' '' *

If rename shows what it will do, and you're fine with it, the real
thing. So leave away "-n":

% rename -v 'ztcloud_nfs_parseztaa_1__' '' * 

I like this little tool, and sometimes I fight with it to do even more
time-saving things with it. But I think the fight it needs is worth the
time it takes. 
Oh yes: and sometimes 'rename' wins ... ;)


Good luck
-- 
Wolfgang Pfeiffer
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread bruce
Hey guys...

Thanks for the reply.

The rename cmd actually works.  I just screwed it up, and used the
syntax for Debian which is the regex.

For Fed/Centos et al

rename foo cat files  -- works as expected!

Thanks!




On Sat, Feb 24, 2018 at 10:46 AM, Jon LaBadie  wrote:
> On Sat, Feb 24, 2018 at 10:46:46PM +0800, Ed Greshko wrote:
>> On 02/24/18 22:42, Robert P. J. Day wrote:
>> > On Sat, 24 Feb 2018, Ed Greshko wrote:
>> >
>> >> On 02/24/18 22:03, bruce wrote:
>> >>> Hi.
>> >>>
>> >>> Have a bunch of files with the basic naming of:
>> >>> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
>> >>> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
>> >>> etc..
>> >>>
>> >>> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
>> >>> files, renaming the files to the rest of the filename..
>> >>>
>> >>> Thought it should be simple using rename
>> >>>
>> >>> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
>> >>>
>> >>> However, this didn't work... so.. hmm..
>> >>>
>> >>> How would you guys solve this?
>> >>>
>> >>> SO has a bunch of different solns as well.
>> >> If I understand correctly you want 
>> >> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
>> >> renamed to aa_1__WGS_7500_001__parse.dat, etc?
>> >> And all the files follow the pattern with the same length?
>> >>
>> >> If so, the simple script
>> >>
>> >> #!/bin/bash
>> >>
>> >> for file in *dat
>> >>
>> >> do
>> >> name=`echo $file | cut -c20-48`
>> >> mv $file $name
>> >> done
>> >>
>> >> does it.
>> >   fedora has a "rename" command that would seem to be designed for
>> > just this sort of thing.
>> >
>>
>> I've not used "rename".  And the OP said what he tried didn't work.  So, you 
>> have the
>> answer or you are just saying you don't like my script?
>>
> The thing I don't like is your script has the potential of
> modifying unintended files.  I'd use one of the shell's
> variable expansion features to strip just what was unwanted.
>
> for f in *.dat
> do
>   echo mv $f ${f/zt...aa/aa}
> done
>
> Fill in the ... with the actual chars.
> The "echo" gives a test run to see what will be done with no echo.
> mv may complain about ",dat" files that don't match the "zt...aa"
> pattern, "original and new name identical.
>
> jon
>>
>> --
>> A motto of mine is: When in doubt, try it out
>>
>
>
>
>
>> ___
>> users mailing list -- users@lists.fedoraproject.org
>> To unsubscribe send an email to users-le...@lists.fedoraproject.org
>
 End of included message <<<
>
> --
> Jon H. LaBadie  jo...@jgcomp.com
> ___
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Jon LaBadie
On Sat, Feb 24, 2018 at 10:46:46PM +0800, Ed Greshko wrote:
> On 02/24/18 22:42, Robert P. J. Day wrote:
> > On Sat, 24 Feb 2018, Ed Greshko wrote:
> >
> >> On 02/24/18 22:03, bruce wrote:
> >>> Hi.
> >>>
> >>> Have a bunch of files with the basic naming of:
> >>> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> >>> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> >>> etc..
> >>>
> >>> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> >>> files, renaming the files to the rest of the filename..
> >>>
> >>> Thought it should be simple using rename
> >>>
> >>> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> >>>
> >>> However, this didn't work... so.. hmm..
> >>>
> >>> How would you guys solve this?
> >>>
> >>> SO has a bunch of different solns as well.
> >> If I understand correctly you want 
> >> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> >> renamed to aa_1__WGS_7500_001__parse.dat, etc?
> >> And all the files follow the pattern with the same length?
> >>
> >> If so, the simple script
> >>
> >> #!/bin/bash
> >>
> >> for file in *dat
> >>
> >> do
> >> name=`echo $file | cut -c20-48`
> >> mv $file $name
> >> done
> >>
> >> does it.
> >   fedora has a "rename" command that would seem to be designed for
> > just this sort of thing.
> >
> 
> I've not used "rename".  And the OP said what he tried didn't work.  So, you 
> have the
> answer or you are just saying you don't like my script?
> 
The thing I don't like is your script has the potential of
modifying unintended files.  I'd use one of the shell's
variable expansion features to strip just what was unwanted.

for f in *.dat
do
  echo mv $f ${f/zt...aa/aa}
done

Fill in the ... with the actual chars.
The "echo" gives a test run to see what will be done with no echo.
mv may complain about ",dat" files that don't match the "zt...aa"
pattern, "original and new name identical.

jon
> 
> -- 
> A motto of mine is: When in doubt, try it out
> 




> ___
> users mailing list -- users@lists.fedoraproject.org
> To unsubscribe send an email to users-le...@lists.fedoraproject.org

>>> End of included message <<<

-- 
Jon H. LaBadie  jo...@jgcomp.com
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Doug H.
On Sat, 2018-02-24 at 09:03 -0500, bruce wrote:
> Hi.
> 
> Have a bunch of files with the basic naming of:
> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> etc..
> 
> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> files, renaming the files to the rest of the filename..
> 
> Thought it should be simple using rename
> 
> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> 
> However, this didn't work... so.. hmm..
> 
> How would you guys solve this?


I think the language might be:

rename 'ztcloud_nfs_parseztaa' 'aa' zt*.dat

-- 
Doug H.
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Ed Greshko
On 02/24/18 22:42, Robert P. J. Day wrote:
> On Sat, 24 Feb 2018, Ed Greshko wrote:
>
>> On 02/24/18 22:03, bruce wrote:
>>> Hi.
>>>
>>> Have a bunch of files with the basic naming of:
>>> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
>>> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
>>> etc..
>>>
>>> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
>>> files, renaming the files to the rest of the filename..
>>>
>>> Thought it should be simple using rename
>>>
>>> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
>>>
>>> However, this didn't work... so.. hmm..
>>>
>>> How would you guys solve this?
>>>
>>> SO has a bunch of different solns as well.
>> If I understand correctly you want 
>> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
>> renamed to aa_1__WGS_7500_001__parse.dat, etc?
>> And all the files follow the pattern with the same length?
>>
>> If so, the simple script
>>
>> #!/bin/bash
>>
>> for file in *dat
>>
>> do
>> name=`echo $file | cut -c20-48`
>> mv $file $name
>> done
>>
>> does it.
>   fedora has a "rename" command that would seem to be designed for
> just this sort of thing.
>

I've not used "rename".  And the OP said what he tried didn't work.  So, you 
have the
answer or you are just saying you don't like my script?


-- 
A motto of mine is: When in doubt, try it out



signature.asc
Description: OpenPGP digital signature
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Robert P. J. Day
On Sat, 24 Feb 2018, Ed Greshko wrote:

> On 02/24/18 22:03, bruce wrote:
> > Hi.
> >
> > Have a bunch of files with the basic naming of:
> > ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> > ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> > etc..
> >
> > I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> > files, renaming the files to the rest of the filename..
> >
> > Thought it should be simple using rename
> >
> > rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> >
> > However, this didn't work... so.. hmm..
> >
> > How would you guys solve this?
> >
> > SO has a bunch of different solns as well.
>
> If I understand correctly you want 
> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> renamed to aa_1__WGS_7500_001__parse.dat, etc?
> And all the files follow the pattern with the same length?
>
> If so, the simple script
>
> #!/bin/bash
>
> for file in *dat
>
> do
> name=`echo $file | cut -c20-48`
> mv $file $name
> done
>
> does it.

  fedora has a "rename" command that would seem to be designed for
just this sort of thing.

rday
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org


Re: basic issue/question -- renaming in mass a bunch of files

2018-02-24 Thread Ed Greshko
On 02/24/18 22:03, bruce wrote:
> Hi.
>
> Have a bunch of files with the basic naming of:
> ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> etc..
>
> I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> files, renaming the files to the rest of the filename..
>
> Thought it should be simple using rename
>
> rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
>
> However, this didn't work... so.. hmm..
>
> How would you guys solve this?
>
> SO has a bunch of different solns as well.

If I understand correctly you want 
ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
renamed to aa_1__WGS_7500_001__parse.dat, etc?
And all the files follow the pattern with the same length?

If so, the simple script

#!/bin/bash

for file in *dat

do
name=`echo $file | cut -c20-48`
mv $file $name
done

does it.

-- 
A motto of mine is: When in doubt, try it out



signature.asc
Description: OpenPGP digital signature
___
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org