v***@yahoo.com
2014-02-24 16:49:19 UTC
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 ?
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 ?