Alan McKinnon <[email protected]> [11-02-12 13:44]:
> Apparently, though unproven, at 13:25 on Saturday 12 February 2011,
> [email protected] did opine thusly:
>
> > Hi,
> >
> > I am trying to instruct sed to insert a line of text before
> > a matched line. The whole command should fit into one
> > physical (command) line.
> >
> > Is it possible? And how is it possible?
> >
> > Thank you very much for any hint in advance!
> > Best regards,
> > mcc
>
>
> There's nothing special about a line, it's just a bunch of characters that
> end
> with a newline (itself just a character).
>
> But you can't insert stuff at arbitrary points, you can only replace stuff
> with other stuff. You can replace the start of line marker (^), so do this:
>
> $ cat sed.txt
> 1
> 2
> $ cat sed.txt | sed -e 's/^/a\n/g'
> a
> 1
> a
> 2
>
> I replaced "start of line" with "a and a newline". Modify the regex to suit
> your needs. This gets awkward though, as you can search with a regex but only
> replace a literal. If you need to insert some line before any line containing
> say a "z" for example, then that is way beyond sed's capabilities and you are
> into awk|perl territory.
>
> You didn't clearly state what you are trying to do with examples, so the
> above
> vague wishy-washy goop is the best I can do for you.
>
>
> --
> alan dot mckinnon at gmail dot com
>
Hi,
I update my MakeHuman svn source and the Blender svn source on a daily
basis. Currently the Blender folks did a change in the registration
code for Blender scripts. The MakeHuman folks provide a script, which
is needed to load the putput of MakeHuman into Blender. This script
isn't "new registration ready".
I have to do the following the changes to the Makehuman script (a
handfull):
change this: =======================================
def registration()
<script specific stuff
def unregistration()
<script specific stuff
into this: =========================================
def registration()
bpy.utils.register_module(__name__)
<script specific stuff
def unregistration()
bpy.utils.unregister_module(__name__)
<script specific stuff
until the MakeHuman folks have time to integrate my patch into their
code.
Since I do update often I would have to edit all these files by hand
every time.
It would be much more time saveing, if a sed-oneliner from the
commandline, saved into the shell history, could do this for me....
I googled a little in beforehand and found the "a" command, but I
didn't managed to get it working for me...so...
Best regards,
mcc