bug-bash
[Top][All Lists]
Advanced

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

Re: Help with sed


From: William Park
Subject: Re: Help with sed
Date: Sat, 17 Apr 2010 14:23:35 -0400
User-agent: Mutt/1.4.2.3i

On Fri, Apr 16, 2010 at 01:22:24AM -0700, Radim wrote:
> 
> Hello,
> I have such script:
> 
> (ONLY THIS THREE LINES ARE THE COMMANDS )
> content=$(cat $script | sed  '/function codecs/,/fi;/d');
> content=$(echo $content | sed -n '/mandriva/,/fi;}/p');
> content=$(echo $content | sed  '/^\s*urpmi[:space:]--auto/p');
> 
> But it doesn't work as I would expected.
...
> What I try to do:
> 1) To delete the codecs function of the output.
> 2) To get the "if mandriva" block
> 3) from that block to get lines of urpmi
> 
> Anybody help?

Key insight would be 

    content=$(cat $script | sed ...)
    echo "$content" > x

Look at "x", and see what you got.  Why not just put all 3 "sed"
filters in a pipe?

-- 
William





reply via email to

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