Say I had a config file /etc/emails.confemail1 = user@dinkum.dorg email2 = user@winkum.worgemail3 = user@stinkum.storgand I wanted to get email2I 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?
What the equivalent of grep | cut using sed or awk?
sed;awk;grep;cat;cut
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