How to extract specific lines
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
• 1,031 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello toomu2000!
We believe that this post does not fit the main topic of this site.
This doesn't appear to be a bioinformatics question. Try stackoverflow, where they'll tell you to write a short perl or python script.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!