I am using grep to extract the expiration date from a WHOIS record. The command line I use is:
whois -H domainname.com | grep -m 1 'Expir'
and I get what I need, i.e. the line with the first match containing 'Expir'. However, I would like to trim this output and get only the date, i.e. xxxx-xx-xx.
Currently, the output looks like this:
Registry Expiry Date: 2018-01-23T16:07:52Z
There are extra characters after the date, delimited by the character T, as well as extra characters before the date. How can I eliminate all those and keep the date only?