computing
  • 6

Batch File To Extract Data From Text File

  • 6

Hi

I have a text file, ‘test1.txt’. It contains data in the following format:

cn=lagrim@xplornet.com,o=combined,c=us
objectClass=top
objectClass=person
objectClass=organizationalPerson
objectClass=inetOrgPerson
objectClass=ePerson
cn=Edison
cn=lagrim@xplornet.com
sn=Baker
uid=lagrim@xplornet.com

How can I extract the “uid” field into another text file and add it in the following format.
user import lagrim@xplornet.com cn=lagrim@xplornet.com,o=combined,c=us
user modify lagrim@xplornet.com account-valid yes

I will later run the new text file as a batch script.

Any advice will be greatly appreciated.

Share