Search for an Expression/Phase and Delete lines

Find, replace, find in files, replace in files, regular expressions

Search for an Expression/Phase and Delete lines

Postby Isay2U » Sun Oct 16, 2005 12:45 am

Hi all,

I am wondering if there is a way to search on a expression/phase and delete the whole line?

Example: I am trying to delete the line with the X400 address on 4000 users

dn: CN=xxx xxx,CN=Users,DC=home,DC=ca
changetype: modify
proxyAddresses: SMTP:xxxxxx@home.ca
proxyAddresses:
X500:/o=home/ou=First Administrative Group/cn=Recipients/cn=xxxxxx
proxyAddresses: X400:c=us;a= ;p=home;o=Exchange;s=xxx;g=xxx;

dn: CN=yyy yyy,CN=Users,DC=home,DC=ca
changetype: modify
proxyAddresses:
proxyAddresses:
X500:/o=home/ou=First Administrative Group/cn=Recipients/cn=yyyyyy
proxyAddresses: SMTP:yyyyyy@home.ca
proxyAddresses: X400:c=us;a= ;p=home;o=Exchange;s=yyy;g=yyy;

Thanks for any help.
DCB
User avatar
Isay2U
Newbie
 
Posts: 7
Joined: Fri Oct 14, 2005 11:00 pm

Re: Search for an Expression/Phase and Delete lines

Postby Mofi » Sun Oct 16, 2005 1:56 pm

That's an easy regular expression replace. In UltraEdit style:

Find What: %proxyAddresses: X400:*^p
Replace With:

And in Unix style:

Find What: ^proxyAddresses: X400:.*\p
Replace With:

The style is set at Advanced - Configuration - Find - Unix style Regular Expressions.

And make sure, the last line of the file is a blank line, if the last line with characters is a X400: line. ^p or \p means line ending and not also end of file!!!
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Search for an Expression/Phase and Delete lines

Postby Isay2U » Sun Oct 16, 2005 10:05 pm

Thank you for your quick response Mofi; I do appriciate your assistance.

I got it working using "^proxyAddresses: X400:.*\p". Thank you again.
David.
User avatar
Isay2U
Newbie
 
Posts: 7
Joined: Fri Oct 14, 2005 11:00 pm


Return to Find/Replace/Regular Expressions