Avatar of richsark
richsarkFlag for United States of America

asked on 

parse an input file and create new output file

HI,

I require your expertise please.

I have a log file thats structured like so: (( See Code snippet ))

I am looking for a way to parse this file named "show-zones.log" and look for any "delegate_to" that has 255.255.255.255 with the matching "display_domain"

if it does, I need to create a new txt file named "delete-zones.ibcli" that shows it like so:

conf zone delete 84.117.142.in-addr.arpa
conf zone delete 85.117.142.in-addr.arpa
conf zone delete 86.117.142.in-addr.arpa


Thank you in advanced !


--- ---
                   delegate_to : dns-slave.as.qc.foo.ca,255.255.255.255
                   delegate_to : dns-master.as.qc.foo.ca,255.255.255.255
                display_domain : 84.117.142.in-addr.arpa
             ms_allow_transfer : NSOnly
                  ms_ddns_mode : None
                    ms_managed : None
                          name : 142.117.84.0/24
                        prefix : 84
                         views : default
--- ---
                   delegate_to : dns-slave.as.qc.foo.ca,255.255.255.255
                   delegate_to : dns-master.as.qc.foo.ca,255.255.255.255
                display_domain : 85.117.142.in-addr.arpa
             ms_allow_transfer : NSOnly
                  ms_ddns_mode : None
                    ms_managed : None
                          name : 142.117.85.0/24
                        prefix : 85
                         views : default
--- ---
                   delegate_to : dns-slave.as.qc.foo.ca,255.255.255.255
                   delegate_to : dns-master.as.qc.foo.ca,255.255.255.255
                display_domain : 86.117.142.in-addr.arpa
             ms_allow_transfer : NSOnly
                  ms_ddns_mode : None
                    ms_managed : None
                          name : 142.117.86.0/24
                        prefix : 86
                         views : default
--- ---

Open in new window

PerlShell Scripting

Avatar of undefined
Last Comment
Steve Knight
ASKER CERTIFIED SOLUTION
Avatar of Carl Bohman
Carl Bohman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Hmm, why did this pop up in Windows batch scripting before?!
Avatar of richsark
richsark
Flag of United States of America image

ASKER

Thanks guys, let me try and revert .

Thanks very much
SOLUTION
Avatar of parparov
parparov
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of richsark
richsark
Flag of United States of America image

ASKER

Hi, yes... Correct , there might not be a second delegate. Good catch parparov.

Thanks you kindly
Avatar of richsark
richsark
Flag of United States of America image

ASKER

Hi guys. I have used bouncy script with the modification of parparov .

Though I thank dragon-it, for a windows script. I did not use that one.

Thanks all for your help
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

No problem, didn't see perl, just popped up in my alerts for Windows scripting.  Still don't know how!
Perl
Perl

Perl is a high-level, general-purpose, interpreted, dynamic programming languages with over 25 years of development. Perl 5 runs on over 100 platforms from portables to mainframes and is suitable for both rapid prototyping and large-scale development projects. Perl gained widespread popularity as a Common Gateway Interface (CGI) scripting language, in part due to its regular expression and string parsing abilities. In addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications.

26K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo