[Tfug] OK, I need one more funky little sed or bash code...

Bexley Hall bexley401 at yahoo.com
Sun Mar 28 15:16:29 MST 2010


Hi Jim,

> I need to find every line that ends with a "{" character
> and put a new
> line right above it, exactly like this:
> 
>       } #


Huh?  Do you mean a "new line containing "} #" or "a newline
above the line with the '{'"?
 
> ...ONLY so long as that line to be added doesn't already
> exist!
> 
> Follow?  Now, lines that end in "{" vary.  Here's
> some examples:
> 
>       threaten voting equipment={
> 
>         gather knowledge={
> 
>           from insider={
> 
> They're all indented with either six or eight or maybe 10
> and even 12 spaces...maybe that'll help, I dunno.

Do you want this to become:
\n
       threaten voting equipment={
 
\n
         gather knowledge={
 
\n
           from insider={

or;

} #
       threaten voting equipment={
 
} #
         gather knowledge={
 
} #
           from insider={

Not sure of the meaning of your "...ONLY" conditional.

How about a "text fragment" before and after?
 
> Anybody?



      




More information about the tfug mailing list