Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Look for standard lines inside a file using REGEX

Status
Not open for further replies.

viadisky

Technical User
Jun 19, 2003
110
GB
Hi,

I need the help of all regex gurus out there.

Listed below are standard lines I need to check inside a file. A file should be okay if all these lines can be found and in the right order.

ip name-server 4.3.2.1
ip name-server 3.2.3.2
ip name server 1.1.1.1

I created a very basic REGEX to do this:

^ip name-server 4\.3\.2\.1$
^ip name-server 3\.2\.3\.2$
^ip name server 1\.1\.1\.1$

If additional "ip name-server <IP Address>" will be placed on top or below the standard lines, the REGEX I created won't be able to see these lines.

Can anybody suggest an easy way how to modify my REGEX?

Regards
viadisky



 
Ooppsss, i had typo error in my previous email (sorry)

ip name-server 4.3.2.1
ip name-server 3.2.3.2
ip name-server 1.1.1.1

I created a very basic REGEX to do this:

^ip name-server 4\.3\.2\.1$
^ip name-server 3\.2\.3\.2$
^ip name-server 1\.1\.1\.1$

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top