"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:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 .TH PREN 1 "2021 Apr 30" littleutils
    2 .SH NAME
    3 pren \- rename files using Perl regular expressions (perl rename)
    4 .SH SYNOPSIS
    5 \fBpren\fR
    6 \fB\-e\fR\~\fIperl_regex\fR
    7 [\fB\-h(elp)\fR]
    8 [\fB\-n(o_rename)\fR]
    9 [\fB\-q(uiet)\fR]
   10 [\fB\-v(erbose)\fR]
   11 \fIfile\|.\|.\|.\fR
   12 .SH DESCRIPTION
   13 \fBpren\fR renames files using Perl regular expressions
   14 .SH OPTIONS
   15 .TP
   16 \fB\-e\fR\~\fIperl_regex\fR
   17 Specify the Perl regular expression to be used for file renames.
   18 .TP
   19 \fB\-h\fR
   20 Print help and quit.
   21 .TP
   22 \fB\-n\fR
   23 Do not actually rename any files.  Instead, echo the rename command that would
   24 be used.
   25 .TP
   26 \fB\-q\fR
   27 Be quiet.  Suppress the usual messages that list the file renames that actually
   28 occur.
   29 .TP
   30 \fB\-v\fR
   31 Be verbose.  Generate messages for file renames that are skipped because the name
   32 does not change.
   33 .SH EXAMPLES
   34 .TP
   35 Turn all instances of "apple" into "orange":
   36 pren \-e 's/apple/orange/' apple01.txt apple02.txt apple03.txt
   37 .br
   38 Yields: orange01.txt orange02.txt orange03.txt
   39 .TP
   40 Improve the naming of digital camera images:
   41 pren \-e 's/^dsc/wedding/' dsc*.jpg
   42 .br
   43 Yields: wedding*.jpg
   44 .TP
   45 Rearrange date format:
   46 pren \-e 's/(\\d\\d)(\\d\\d)(\\d\\d)/20${3}-${1}-${2}/' xmas_123104.txt
   47 .br
   48 Yields: xmas-2004-12-31.txt
   49 .TP
   50 Poor man's \fBlowercase\fR utility:
   51 pren \-e 'y/[A-Z]/[a-z]/' DSC*.JPG
   52 .br
   53 Yields: dsc*.jpg
   54 .TP
   55 Replace all underscores with spaces:
   56 pren \-e 's/_/ /g' song_name_*.mp3
   57 .br
   58 Yields: "song name *.mp3"
   59 .TP
   60 Rename all files in a directory hierarchy:
   61 find . \-depth \-print0 | xargs \-0 pren \-e 's/apple/orange/'
   62 .br
   63 Note: The "\-depth" switch is necessary to rename files \fIbefore\fR
   64 .br
   65       renaming the directories that contain them.
   66 .SH BUGS
   67 Symbolic links are not handled well by \fBpren\fR.  For example, suppose you
   68 have a file called "FOObar" and a symbolic link called "BARfoo" pointing to it.
   69 If you rename both of them using \fBpren\fR, the symlink will become broken, as
   70 it will still point to "FOObar".
   71 .SH SEE ALSO
   72 \fBlowercase\fR(1), \fBuppercase\fR(1), \fBperl\fR(1), \fBperlop\fR(1),
   73 \fBperlre\fR(1), \fBprename\fR(1), \fBrename\fR(1), \fBmmv\fR(1)
   74 .SH COPYRIGHT
   75 Copyright (C) 2005-2020 by Brian Lindholm.  This program is free software; you
   76 can use it, redistribute it, and/or modify it under the terms of the GNU
   77 General Public License as published by the Free Software Foundation; either
   78 version 3, or (at your option) any later version.
   79 
   80 This program is distributed in the hope that it will be useful, but WITHOUT ANY
   81 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   82 PARTICULAR PURPOSE.  See the GNU General Public License for more details.