File: msrp.1

package info (click to toggle)
msrp 0.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 448 kB
  • ctags: 79
  • sloc: sh: 3,661; cpp: 489; makefile: 51
file content (88 lines) | stat: -rw-r--r-- 3,071 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
.\" Process this file with
.\" groff -man -Tascii msrp.1
.\"
.TH msrp 1 "DEC 2007" Linux "User Manuals"
.SH NAME
msrp \- search and replace file contents and metadata recursively.
.SH SYNOPSIS
.B msrp searchpat repstr [-cdfiqsw] [--svn | --hg] [file1 | dir1/] [file2 | dir2/]...
.SH DESCRIPTION
.B msrp
reads in one or more file or directory arguments and applies a
regular-expression based global transformation.  It searches for searchpat
as a Perl 5 compatible regular expression and substitutes repstr for
it for all listed arguments that follow.  msrp applies the substitution
to both the contents of files as well as the filenames themselves.
If a filename is changed by a substitution, then the file is renamed to
reflect the new value.  This type of renaming is useful when using
filenames that are also used in program source code text and both must
be kept consistent together.  If a directory argument is given, that
directory is recursively traversed unless the \-s option is given.
Directories can also be renamed and all three modes of operation are
enabled by default.  File contents, file names, and directory names are
all transformed by the given regular expression substitution.  Note that
subdirectories starting with . are not entered recursively unless the
--dot-paths option is specified.

If a numbered back-substitution group is wanted, simply use a backslash
followed by a decimal digit to refer to a captured group in the replacement
string.  Capture group 0 represents the entire match string.

If a file is unchanged by a given regular expression then it will not have
its modification time updated by msrp.  Only files that are actually changed
are touched.  The following options can customize behavior:
.TP
\fB\-c\fR
disable file contents transformation
.TP
\fB\-d\fR
disable directory renaming transformation
.TP
\fB\-f\fR
disable filename renaming transformation
.TP
\fB\-i\fR
perform case-insensitive matching
.TP
\fB\-q\fR
quiet mode, with no extra status messages
.TP
\fB\-s\fR
do not recursively enter subdirectories
.TP
\fB\-w\fR
enable word-boundary constraint. This means the matched expression must
begin and end with a word boundary, as in perl \\b regexp notation.
.TP
\fB\--hg or --mercurial \fR
enable Mercurial renaming.
.TP
\fB\--svn or --subversion \fR
enable Subversion renaming.
.TP
.SH EXAMPLES
Rename all files in the current directory recursively searched that end
with the extension .html and rename them to .htm without touching
file contents or directories:
.TP
msrp \-c \-d \(aq(.*)html$\(aq \(aq\\1htm\(aq .
.TP
Copy olddebian/ dir to debian/ while changing oldpkgname to newname in
files, directories, and filenames:
.TP
cp -rv olddebian/ debian && msrp oldpkgname newname debian
.TP
Normalize extension case of .c files so .C becomes .c:
.TP
msrp \-c \-d \-i \(aq(.*)\\.c$\(aq \(aq\\1.c\(aq .
.TP
Rename vector to zector in Subversion:
.TP
msrp --svn vector zector .
.TP
.SH ENVIRONMENT
No environment variables.
.SH BUGS
Please report bugs to the Debian BTS.
.SH AUTHOR
Rudi Cilibrasi <cilibrar@cilibrar.com>