I needed to change a
function foo('', '', 'whatever')
to a
bar('whatever')
in a bunch of files.
There are many ways to do this, I decided to edit directly the files with good ol' find & sed
find . -name "*.js" -exec sed --in-place -re "s/foo\([^,]*,[^,]*,[^'\"]*(['\"])(.*)\1/bar('\2')/g" {} \;
options:
-r: Key points where to use the full extended regular expression
-r: expression
\1: notice I match the initial ' or " with a back reference!
Python, IaC, algo trading, programming, server administration, Linux, PHP, CakePHP, PostgreSQL, MySQL, Joomla ...
Subscribe to:
Post Comments (Atom)
cancel script completely on ctrl-c
I found this question interesting: basically how to cancel completely a script and all child processes : You do this by creating a subro...
-
I've been using WinScp and a script to compress files at maximum compressión, name the file as name_YYMMDD-HHMM.rar, and send them to a...
-
tomado de: http://el-directorio.org/ErroresComunesPhpmyadmin ARREGLAR ERROR 1045 (28000): Access denied for user 'root'@'localho...
-
Styling Excel cells with mso-number-format mso-number-format:"0" NO Decimals mso-number-format:...
No comments:
Post a Comment