# Grep from a certificate

**URL:** <https://community.unix.com/t/grep-from-a-certificate/365109>\
**Category:** Shell Programming and Scripting\
**Created:** [February 17, 2017, 4:12pm UTC](https://community.unix.com/t/grep-from-a-certificate/365109 "2017-02-17T16:12:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loc](https://community.unix.com/letter_avatar/loc/32/6_449c533f586939b6e5f246632a46421f.png) [@Loc](https://community.unix.com/u/Loc)\
**Post date:** [February 17, 2017, 4:12pm UTC](https://community.unix.com/t/grep-from-a-certificate/365109/1 "2017-02-17T16:12:45Z")

</div>

I can view the openSSL certifcate with this command

```nohighlight
openssl x509 -text -in myCertificate.pem

```

I just wanted to see when the cert will expire only. The line which I want to read is,  
Not After : Jul 28 14:09:57 2015 GMT  
I tried using the grep command but it doesn't display anything.

```nohighlight
grep "After" myCertificate.pem

```

Is there a way that I can read only that line of the certificate?? If not with grep then maybe with some other command.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![RudiC](https://community.unix.com/letter_avatar/rudic/32/6_449c533f586939b6e5f246632a46421f.png) [@RudiC](https://community.unix.com/u/RudiC)\
**Post date:** [February 17, 2017, 4:24pm UTC](https://community.unix.com/t/grep-from-a-certificate/365109/2 "2017-02-17T16:24:32Z")

</div>

That certificate will be encoded, not clear text. `grep` works on clear text. Try

```nohighlight
openssl x509 -text -in myCertificate.pem | grep After

```
