sed string replacements
Scott Haneda
talklists at newgeo.com
Sat Jun 19 14:59:22 PDT 2010
>> Thanks. Well, at least it is not just me that is getting stuck on this one. I have tried the above, with ' and with " to no promising results.
>>
>> $cat maker
>> #!/bin/bash
>> VERSION_HEADER=`cat VERSION.header`
>> #echo "$VERSION_HEADER"
>>
>> sed -e "s/_VERSION_HEADER_/$VERSION_HEADER/" DOCUMENTATION
>>
>> $./maker
>> sed: 1: "s/_VERSION_HEADER_/# Hi ...": unescaped newline inside substitute pattern
>
> Yup, sed doesn't do multiline replacements easily.
>
> I'd probably write a php or perl script to do this; much more flexible than a shell script.
Yeah, you know what, for the time I have put into figuring this out, and the time it would take me to even get up to speed in it with perl, I think I may just do that. I can deal with this entire thing in php in the time I have put into a one liner in bash, which still does not work.
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.
--
Scott * If you contact me off list replace talklists@ with scott@ *
More information about the macports-dev
mailing list