# Repetitive command line creation with your editor of choice
Project description
Given a list of file names, this will put the list of files into a text
file, open that with $EDITOR
(or $VISUAL
if $EDITOR
is not set). After
the editor returns, any changed names in the text file will cause a
command (default: mv
) to be executed with the original and new filename.
This is very useful in carrying out rename operations that are easy to specify with your text editor, but hard to specify with wildcards.
If you ever wrote something like this (and -- as seen here -- still got shell quoting wrong, because it's tedious), then this tool is for you:
for f in *.mp3; do; mv "$f" "$(basename $f .mp3)_foo.mp3"; done
Also, you can use different commands instead of mv
, and add options
for the input and output parameters (oggenc <infile> -o <outfile>
):
rpt -c "oggenc {old} -o {new}" *.wav
If you have a command without {old}
and {new}
, {old} {new}
will be
appended to the command line (cp <infile> <outfile>
):
rpt -c cp *.wav
You can put {old}
and {new}
wherever you want, in different order
and also multiple times (if needed):
rpt -c "mpg123 -w {new} {old}" *.mp3
To go all-out silly, you can set the $EDITOR
variable to something
that will automatically change each input line, for example to make
a backup file of every .py
file in the current folder:
env EDITOR="sed -i -e '/^[^#]/ s/$/.bak/'" rpt -c cp *.py
This will use sed
as the editor and in-place edit the temporary
text file created by rpt
and append .bak
to all non-comment lines
(the /^[^#]/
part) in the input file, and with cp
as the command
will call cp <filename> <filename>.bak
for every input file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file rpt-2.0.0.tar.gz
.
File metadata
- Download URL: rpt-2.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a665e23351f5f8888a41434464f411e1fb8e66de35509e2db00df6096de544f |
|
MD5 | d24171b9e5eaa2f98803ea9b96983784 |
|
BLAKE2b-256 | dc99830ee1d3c34803493068428264c670faa09c0dabfbfcdb5a34299f5da70f |