Re: Beginner -

satish <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <CAGofMXPjnjMC-oRRLJ-r-PkWn_fnHTAd01=_R0hUss8OhQunnw@mail.gmail.com>
Try this after you get the slot variable.

sed "/$slot (/,/Touch" filename l grep Touch

Regards,
Satish
On Feb 24, 2014 10:19 PM, <[email protected]> wrote:

>
>
> Example data file 10.10.10.10.log :
>
>
> primary
>    Factory   CTS 1.9.6(2) P1
>   *Slot 1    CTS 1.9.6(2) P1
>    Slot 2    CTS 1.7.1(4864) P1
>   loads file information
>     Factory  (cmterm-CTS.1-9-6-2R-K9.P1)
>         CTS: CTS.1-9-6-2R-K9.P1.sbn
>       Touch: CTSDEV.1-9-6-2R-K9.P1.SPA
>     Slot 1   (cmterm-CTS.1-9-6-2R-K9.P1)
>         CTS: CTS.1-9-6-2R-K9.P1.sbn
>       Touch: CTSDEV.1-9-6-2R-K9.P1.SPA-G
>     Slot 2
>       No loads file
>
> I look for primary  and * to isolate the interesting slot number.
> slot=`sed '/^primary$/,/\*/!d' 10.10.10.10.log | tail -1 | sed s'/*//' |
> awk '{print $1" "$2}'`
> slot = "Slot 1"
> Now I want to get the Touch line for the associate slot number, in this
> case, because the asterisk indicates the interesting slot, "Slot 1"
>
> sed -n '/\s+"$gslot"/p; /Touch:/p' 10.10.10.10.log
> The response
> .
> Slot 1
>       Touch: CTSDEV.1-9-6-2R-K9.P1.SPA
>       Touch: CTSDEV.1-9-6-2R-K9.P1.SPA-G
>
> My question is \
> How do I get only the touch line following the Slot 1 line ?
>
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.