automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] test defs: add subroutine for input unindenting


From: Peter Rosin
Subject: Re: [PATCH] test defs: add subroutine for input unindenting
Date: Thu, 17 Feb 2011 14:39:46 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7

Den 2011-02-17 12:15 skrev Peter Rosin:
> Den 2011-02-15 21:19 skrev Ralf Wildenhues:
>> It's a bit of a shame this uses a temp file though.  awk should be able
>> to cope without (but be sure to try old Solaris awk if you go for it).
> 
> Ahh, who needs awk? :-)
> 
> unindent ()
> {
>   sed -n '
>     x
>     :useit
>     /./{
>       G
>       h
>       s/\n.*//
>       x
>       /x\(.*\)\n\1/s///p

The preceding line can be replaced by this slightly less convoluted thingy.

      s/x\(.*\)\n\1//p


>       s/.*\n//p
>       d
>     }
>     g
>     /^$/{
>       p
>       d
>     }
>     s/\([     ]*\).*/x\1/
>     b useit'
> }

Cheers,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]