This is a short sample but my file will end up with 1000's of entries like this. What I am trying to do

is this:

Parse the file line by line. Look for Device ID: Copy text in Device ID after the : to the newline into a new file appended with a comma continue down the file looking for address: and copy the value after the : and before the newline into

the file wher the device id went on the same line with the associated device with an appened comma. continue down the file and search for Platform: and copy the value between the : and newline to the file

from above after the IP address

Basically I am trying to end up with a comma delimted file. If the above data was run through my

Re: [BillKSmith] need a program that can parse show cdp neig into cvs format
[In reply to]

Can't Post

Hey Bill, Thanks for this. That is exactly what I was meaning, that the formating is sometimes different with IP address imbedded in the line. I have also discovered running through a few more of these that Device Id: is sometimes Device-Id: In addition there is sometimes an IP address listed under the last section Management address(es): so an ip would be caught twice in the script under these condidtions. Not sure how that would affect output.

I just tried to pull down your script and run it against a file and got the following: bash-2.03$ chmod 700 cdpformat.pl bash-2.03$ cdpformat.pl -i cdp discovery.txt -o cleanedcdplist .//cdpformat.pl: use: command not found .//cdpformat.pl: use: command not found .//cdpformat.pl: use: command not found .//cdpformat.pl: use: command not found .//cdpformat.pl: use: command not found .//cdpformat.pl: Readonly::Scalar: command not found .//cdpformat.pl: line 7: syntax error near unexpected token `=>' .//cdpformat.pl: line 7: `Readonly::Scalar my $FIELD => ' bash-2.03$