From: superpollo on
Seebs ha scritto:
> On 2010-06-08, superpollo <utente(a)esempio.net> wrote:
>> Seebs ha scritto:
>>> On 2010-06-08, superpollo <utente(a)esempio.net> wrote:
>>>> no no i got the point thank you. but then i asked for standard advice,
>>>> since the man criticized (rightly) about unclean features in my script.
>
>>> Okay. Well, the most general answers I can give you are the autoconf
>>> manual's section on portable code
>
>> http://www.gnu.org/software/autoconf/manual/html_node/Portable-Shell.html
>
>> this?
>
> What do you think? Have you made some kind of effort to compare the thing
> you found to the description, to see whether it seems related in any way?
> For instance, given that the question had to do with portable or standard
> shell scripting, does the page you've linked to appear to discuss ways to
> write more portable shell code? Do you see any evidence that might lead
> to the theory that this is part of the "autoconf manual"?
>
> Why are you asking this question?

i had strong suspects that the link i posted was the relevant one, but
since (as i understand it) is it a bit of a technical reading which
supposes a lot of background, i found it proper to ask for your kind
confirmation before diving into it.

thanks for your advice

bye
From: Geoff Clare on
WH wrote:

> On 06/06/10 02:01, shulamitm wrote:
>> I need to change the following :
>>
>> ERROR1 1
>> ERROR2 1
>> WARNING1 0
>> WARNING2
>> 0
>> WARNING3
>> 0
>> ERROR3 1
>>
>>
>> To:
>>
>>
>>
>> ERROR1 1
>> ERROR2 1
>> WARNING1 0
>> WARNING2 0
>> WARNING3 0
>> ERROR3 1
>>

> sed -e '/\w\W\+\w/!N' -e 's/\n/\t/' file

$ printf 'WARNING1\t0\nWARNING2\n0\nWARNING3\n0\nERROR3\t1\n' |
> sed -e '/\w\W\+\w/!N' -e 's/\n/\t/'
WARNING1 0tWARNING2
0tWARNING3
0tERROR3 1

$ printf 'WARNING1\t0\nWARNING2\n0\nWARNING3\n0\nERROR3\t1\n' |
> sed -e '/[^[:space:]][[:space:]]\{1,\}[^[:space:]]/!N' -e 's/\n/ /'
WARNING1 0
WARNING2 0
WARNING3 0
ERROR3 1

--
Geoff Clare <netnews(a)gclare.org.uk>