Artificial intelligent assistant

What the equivalent of "grep | cut" using sed or awk? Say I had a config file `/etc/emails.conf` email1 = user@dinkum.dorg email2 = user@winkum.worg email3 = user@stinkum.storg and I wanted to get email2 I could do a: grep email2 /etc/emails.conf | cut -d'=' -f2 to get the email2, but how do I do it "cooler" with one sed or awk command and remove the whitespace that the cut command would leave?

How about using awk?


awk -F = '/email2/ { print $2}' /etc/emails.conf


* `-F =` Fields are separated by '='

* `'/email2/ { print $2}'` On lines that match "email2", print the second field

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy a5c7fb0934c86c510b3887314be2c0ad