creating an alias that calls simple renaming
Anzumana opened this issue · 3 comments
renamer --regex --find '(^..).*' --replace '$1.tex' *
is the expression that i want to use.
but for the life of me i can't figure out how i would have to create this as an alias/ bash / zsh script.
alias renamer_help="renamer --help"
works but
when i do thse same with the expression above.
my shell i telling me that
.zshrc:119: renamer --regex --find '(^..).*' --replace '$1.tex' * not found
I basically spend the last couple of hours trying different escape sequence but nothing worked :/
this worked for me, first create the alias for the command and the default options:
$ alias ren="renamer --regex --find \(^..\).* --replace $1.tex"
then run it passing in the files, or glob expression
$ ren *
issue was that i wanted to do cd path/to/file and then the expression so i would not be able to pass *
since the expression would be something along those lings
(cd path/to/file; renamer --regex --find '(^..).*' --replace '$1.tex' *;)
i managed finally to do it using a node script ( wanted to use that anyway :P )
var fs = require('fs');
var exec = require('child_process').execSync;
console.log('file will be renamed for easier referencing inside of latex');
exec("(cd ~/Dropbox/projects/seminar/draft/Inhalt/scrivener/copy/; renamer --regex --find '(^..).*' --replace '$1.tex' *)", {stdio:[0,1,2]}) ;
my latex workflow is now 1 command
yay ^^
thanks for the great utility.
Have a good one
ok, glad you found a solution.. or you could use a simple bash function
function doRename {
cd somewhere
renamer --find this --replace that *
}