[chbot] Lazy software developers please read...

Charles Manning cdhmanning at gmail.com
Wed Aug 6 20:49:25 BST 2014


Volker, in practice you are completely right. sed is not the tool for this job.

In theory it could be. You can do absolutely amazing things in sed,
but it would probably need a multi-page sed script to do this and
learning sed to the nth degree.  That certainly does not fit in the
category of being lazy/efficient.

For anyone wanting their head explode have a read of
http://sed.sourceforge.net/sed1line.txt some beauties like:

 # sort paragraphs of file alphabetically. Paragraphs are separated by blank
 # lines. GNU sed uses \v for vertical tab, or any unique char will do.
 sed '/./{H;d;};x;s/\n/={NL}=/g' file | sort | sed '1s/={NL}=//;s/={NL}=/\n/g'
 gsed '/./{H;d};x;y/\n/\v/' file | sort | sed '1s/\v//;y/\v/\n/'


On Wed, Aug 6, 2014 at 9:29 PM, Volker Kuhlmann
<list0570 at paradise.net.nz> wrote:
> On Wed 06 Aug 2014 20:47:30 NZST +1200, Marek Kuziel wrote:
>
>> > > find .|grep ".c\|.h"|xargs sed -i
>> > > 's/CODE_OR_PATTERN_TO_FIND/NEW_CODE_TO_REPLACE_THE_FOUND_CODE_WITH/'
>
> You can not possibly use such a sed construct to create multi-line
> comments filled in with one keyword per function argument and return
> value. The function declaration may be split over multiple lines, etc
> etc. The suggestion is ridiculous! Scripting that in e.g. python would
> be much saner (and still non-trivial), however it was already clear from
> the OP (see "lazy" in subject) that such solution was wanted to be
> found, not made, and even if found, would provide limited benefit. So
> if you know doxygen I'm afraid I don't understand what you intended your
> sed invocation to achieve that the OP asked for.
>
> Volker
>
> --
> Volker Kuhlmann
> http://volker.top.geek.nz/      Please do not CC list postings to me.
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.linuxnut.co.nz
> http://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Web site: http://kiwibots.org
> Meetings 3rd Monday each month.
>
> When replying, please edit your Subject line to reflect new content.



More information about the Chchrobotics mailing list