ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi i know there is some other threads about grep and parsing but i tryed most of the other ways describe on the other questions and didnt work for me, i would like to parse a openssl log to a .csv and by that make the usual ; to pars the columns .
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (2048 bit)
I want to parse the data in front of "Signature Algorithm :" , the dates in "Not Before:" and "Not After", and the values in front of "C=", "L=" , "CN=", "O=" , "OU= ", "EmaiAddress=" . And finally the Public key algorithm : , and RSA public key value the " (2048 bit) "
to the >> example.csv
The desired output would be :
sha1WithRSAEncryption, Jan 24 11:10:13 2011 GMT, Jan 21 11:10:13 2021 GMT, PT, Jersey, UFO, etc.
thanks in advance.
Last edited by drd0spt; 09-27-2012 at 12:01 PM.
Reason: clear wanted result
For something as involved as you are asking, grep & bash is a bit cumbersome. There is awk, and sed which might thrash it out better for you.
That said, if you do go at this, there is an option for you to use perl's regular expression stuff which is a bit tidier and more definite than posix, in my experience.
man perlre is your friend
I think you mean the data AFTER the keywords---for example, when it finds "Signature Algorithm:", it would return: "sha1WithRSAEncryption"
To be clear, please post the desired output I'm guessing that it would be:
"sha1WithRSAEncryption, Jan 24 11:10:13 2011 GMT, Jan 21 11:10:13 2021 GMT, etc."
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.