"Fossies" - the Fresh Open Source Software Archive

Member "littleutils-1.2.5/extra/pren.1" (29 Oct 2021, 2605 Bytes) of package /linux/privat/littleutils-1.2.5.tar.lz:


Caution: As a special service "Fossies" has tried to format the requested manual source page into HTML format but links to other man pages may be missing or even erroneous. Alternatively you can here view or download the uninterpreted manual source code. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the latest Fossies "Diffs" side-by-side code changes report for "pren.1": 1.2.4_vs_1.2.5.

PREN

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
BUGS
SEE ALSO
COPYRIGHT

NAME

pren − rename files using Perl regular expressions (perl rename)

SYNOPSIS

pren −e perl_regex [−h(elp)] [−n(o_rename)] [−q(uiet)] [−v(erbose)] file...

DESCRIPTION

pren renames files using Perl regular expressions

OPTIONS

−e perl_regex

Specify the Perl regular expression to be used for file renames.

−h

Print help and quit.

−n

Do not actually rename any files. Instead, echo the rename command that would be used.

−q

Be quiet. Suppress the usual messages that list the file renames that actually occur.

−v

Be verbose. Generate messages for file renames that are skipped because the name does not change.

EXAMPLES

Turn all instances of "apple" into "orange":

pren −e ’s/apple/orange/’ apple01.txt apple02.txt apple03.txt
Yields: orange01.txt orange02.txt orange03.txt

Improve the naming of digital camera images:

pren −e ’s/^dsc/wedding/’ dsc*.jpg
Yields: wedding*.jpg

Rearrange date format:

pren −e ’s/(\d\d)(\d\d)(\d\d)/20${3}-${1}-${2}/’ xmas_123104.txt
Yields: xmas-2004-12-31.txt

Poor man’s lowercase utility:

pren −e ’y/[A-Z]/[a-z]/’ DSC*.JPG
Yields: dsc*.jpg

Replace all underscores with spaces:

pren −e ’s/_/ /g’ song_name_*.mp3
Yields: "song name *.mp3"

Rename all files in a directory hierarchy:

find . −depth −print0 | xargs −0 pren −e ’s/apple/orange/’
Note: The "−depth" switch is necessary to rename files before
renaming the directories that contain them.

BUGS

Symbolic links are not handled well by pren. For example, suppose you have a file called "FOObar" and a symbolic link called "BARfoo" pointing to it. If you rename both of them using pren, the symlink will become broken, as it will still point to "FOObar".

SEE ALSO

lowercase(1), uppercase(1), perl(1), perlop(1), perlre(1), prename(1), rename(1), mmv(1)

COPYRIGHT

Copyright (C) 2005-2020 by Brian Lindholm. This program is free software; you can use it, redistribute it, and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.