Saturday, February 17. 2007PHP Pie?Trackbacks
Trackback specific URI for this entry
No Trackbacks
Comments
Display comments as
(Linear | Threaded)
Humm interesting, however a simple editor like VIM does this very nicely and you can even specify a line range :)
Here is how to do it in vim :10,50s/search/replace/g This will replace all the stuff from line 10 to 50 with the keyword asked. It could also be handy to reaplce in all open buffers (files) but i got too lazy to dig into. I keep this question with his Vim Presntation :) Cheers
> a simple editor like VIM
erm, if Vim is 'simple' then what is complex ? anyway : - Vim does not run on windows (well, with cygwin it could)... - PHP does (without cygwin) and : - Vim is as verbose and user-friendly as an old A4 scansheet of sandy newspaper used for toilet-paper replacement. - PHP is as verbose and user-friendly as VIM, but still more user-friendly than perl and its s/wtf/omg/g hideous syntax. so : - Your comment assumes everyone is using gnu linux, and of course Vim as the preferred text editor - Reality is there are MacOS, Windows, and of course tons of editors (including EMACS) that can perform that job too. hint : do not fear php
Yes VIM is simple.
There is GVIM for windows. Even in a "simple" mode for people that are not yet used to the VIM commands. What verbosity do you need? Vim is able to mark the replacements, ask for every single and so on... And on windows I also prefer VIM (GVIM). MacOS I think textmate does the job (Compare it with vim and you find many functions that are very closely) You should try using vim for a while. Then youll be able to harnest its powers.
@Yann: But vim doesn't allow this from the command line, or am I missing something?
@Ilia: The subtle but important difference to perl -p -i -e is that you can run any PHP expression on each line of the processed file. Most processing could be done with Perl too of course, but some native PHP functions could become very handy.
Yep it works with vim in command line ( i never tought doing this before)
In command line you just have to do this. vim -c :10,50s/test/work/g test.txt -c :wq I guess a php script could be usefull too. |
Pay the bills...Calendar
QuicksearchMy PERSONAL BlogNote:
The contents of this blog are my own, PERSONAL opinion and do not represent the thoughts or opinions of the people I work with or for. If you have a beef with something I said, take it up with ME. Thanks (-: |
|||||||||||||||||||||||||||||||||||||||||||||||||