-5

Source :

!
hostname RTR-1
!
boot-start-marker
boot-end-marker
!
logging buffered 64000 informational
no logging console
!
interface FastEthernet0/0
 description LAN
 ip address 172.16.29.250 255.255.255.0
 ip helper-address 172.18.1.130
 ip helper-address 172.18.1.127
 ip tcp adjust-mss 1350
 speed 100
 full-duplex
!
line vty 0 4
 exec-timeout 30 0
 transport input telnet ssh
 transport output telnet ssh
!
end

Output:

interface FastEthernet0/0
 ip helper-address 172.18.1.130
 ip helper-address 172.18.1.127

Or:

!
hostname RTR-1
!
boot-start-marker
boot-end-marker
!
logging buffered 64000 informational
no logging console
!
interface Vlan1
 description LAN
 ip address 172.16.29.250 255.255.255.0
 ip helper-address 172.18.1.130
 ip helper-address 172.18.1.127
 ip tcp adjust-mss 1350
 speed 100
 full-duplex
!
line vty 0 4
 exec-timeout 30 0
 transport input telnet ssh
 transport output telnet ssh
!
end

Output:

interface Vlan1
 ip helper-address 172.18.1.130
 ip helper-address 172.18.1.127

I exactly want to extract the name of interface in which command "helper-address" is configured.

The above source output is stored in file or can be extracted directly from live router

closed as too broad by Braiam, Anthon, Michael Homer, Ramesh, Volker Siegel Oct 28 '14 at 11:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Hi and welcome to the site. We are not a free script writing service and will not do your work for you. We will be happy to help but you need to show us what you've tried and how it failed. Please see our help center on how to ask good questions for this site. – terdon Oct 27 '14 at 13:16
  • 1
    Related: stackoverflow.com/questions/19101596/… . If you can use python, ciscoconfparse seems like just what you need. – Mark Plotnick Oct 27 '14 at 15:20
2
grep "interface\|helper" source.file

Is the task so difficult to ask them here?

UPDATED: If you are haven't grep in your OS you can substitute the script above by just shell-bultins:

while read
do
  case "$REPLY" in
  *interface*) echo "$REPLY" ;;
  *helper*) echo "$REPLY" ;;
  esac
done < source.file
  • I up your answer, however maybe required commend should be done in cisco's ... – Archemar Oct 27 '14 at 11:54
  • @Archemar: in this case IMHO Mayur Patel's question is offtopic on "Unix & Linux". – Cyrus Oct 27 '14 at 12:11
  • 1
    All *nix systems, including embedded ones are on topic here. – terdon Oct 27 '14 at 12:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.