Off topic:How to extract specific lines
0
0
Entering edit mode
9.2 years ago
toomu2000 • 0

I have a file like below:

A user record starts from dn: and ends with a blank line.

If a user record has userlogin, I need to extract the values of dn, userlogin and name to a file.

Can you please help with perl script or shell script?

dn: uid=123,ou=abc,o=company
empnum:: 12
userlogin: enabled
sn: abc
name: test1

dn: uid=124,ou=abc,o=company
empnum:: 13
sn: bcd
name: test2

dn: uid=125,ou=abc,o=company
empnum:: 14
sn: xyz
name: test3

dn: uid=127,ou=abc,o=company
empnum:: 16
userlogin: disabled
name: test5

dn: uid=128,ou=abc,o=company
empnum:: 17
name: test6

Thanks
-Tom

sequencing • 979 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 3000 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6