search and goto next line then take the output

Hi All,

I have a file in which the contents are as shown below:

Number of Dynamic Addresses Allocated : 107790 Addresses:
10.3.29.202,10.47.1.145,10.2.4.98,190.1.89.95,.. (many ip addresses separated by comma)
----
----
----
10.38.3.114,10.38.31.12,205.211.32.175,10.18.30.15,200.122.18.29

Number of Static Addresses ......
Addresses:
----

In this file there are static Ips as well but I am interested only in dynamic Ips.

I would like my output should only include Dynamic Addresses in this format

10.3.29.202|10.47.1.145|10.2.4.98|190.1.89.95|.....
----
----
----
10.38.3.114|10.38.31.12|205.211.32.175|10.18.30.15|200.122.18.29

What command or script i should write to get only dynamic ips in pipe separated format.

Your help is appreciated.

Thanks
Imas

Hope this will be helpful

$ cat f1
Number of Dynamic Addresses Allocated : 107790 Addresses:
10.3.29.202,10.47.1.145,10.2.4.98,190.1.89.95
10.38.3.114,10.38.31.12,205.211.32.175,10.18.30.15,200.122.18.29
Number of Static Addresses Allocated : 107791 Addresses:
11.3.29.202,11.47.1.145,11.2.4.98,190.1.89.95
11.38.3.114,11.38.31.12,205.211.32.175,11.18.30.15,211.122.18.29
Number of Static Addresses Allocated : 107792 Addresses:
12.3.29.202,12.47.1.145,12.2.4.98,190.1.89.95
12.38.3.124,12.38.31.12,205.212.32.175,12.18.30.15,212.122.18.29
Number of Dynamic Addresses Allocated:107793 Addresses:
13.3.29.202,13.47.1.145,13.2.4.98,190.1.89.95
13.38.3.134,13.38.31.13,205.213.32.175,13.18.30.15,213.132.18.29
$ sed -n '/Number of Dynamic/','/Number of Static/p'  f1|grep -v "[a-zA-Z]"|tr "," "|"
10.3.29.202|10.47.1.145|10.2.4.98|190.1.89.95
10.38.3.114|10.38.31.12|205.211.32.175|10.18.30.15|200.122.18.29
13.3.29.202|13.47.1.145|13.2.4.98|190.1.89.95
13.38.3.134|13.38.31.13|205.213.32.175|13.18.30.15|213.132.18.29
$

Another approach:

awk -F, 'NR>1{OFS="|";$1=$1}/Static Addresses/{exit}{print}' file

Hi ranjithPr,

Thank you very much for this piece of code
sed -n '/Number of Dynamic/','/Number of Static/p' f1|grep -v "[a-zA-Z]"|tr "," "|"

It works fine.

Once again thanks a lot.

Also if you could suggest me some book name for learning scripting from abc to programming I will really appreciate.

Thanks
imas