sed string replacements

Ryan Schmidt ryandesign at macports.org
Sat Jun 19 15:17:37 PDT 2010


On Jun 19, 2010, at 16:59, Scott Haneda wrote:

> I have been using php more and more for local shell scripts.  For some reason it feels a little dirty and not like the exactly right way to do it... If it works, it works.
> 
> Thanks for bringing this up, sometimes I get stuck in a line of thought and don't bother to look and see what other hammers are in my tool bag.

That's exactly how I felt about php command line scripts when I was trying to use them that way, but you know, I know php well, and I work quickly in it, and that's the goal. Doesn't really matter if it's the solution other people think is "right" if it works and you understand it.


I did, in fact, end up using awk to accomplish this "replace a placeholder with the contents of a file" idea, in my Canviz project. See this awk script:

http://code.google.com/p/canviz/source/browse/canviz/trunk/insert_file.awk

And this Makefile that uses it in the new.html and old.html rules:

http://code.google.com/p/canviz/source/browse/canviz/trunk/Makefile

By the end, that was more to prove it could be done than to say I was happy with it. I don't think I'd do it that way again in the future.



More information about the macports-dev mailing list