Extract two strings from a file and create a new file with these strings

I have the following lines in a log file. It would be great if some one can help me to create a new file with the just entries in the below format.
66.150.161.195 HPSAC=Z05
66.150.161.196 HPSAC=A05

That is just extract the IP address and the string DPSAC=its value

66.150.161.195 - -&HPSAC=Z05"
66.150.161.196 -  -&HPSAC=A05"

Hi

$ sed 's/\([^ ]*\).*\(HPSAC=[^\&]*\).*/\1 \2/' file
66.150.161.195 HPSAC=Z05
66.150.161.196 HPSAC=A05

Guru.

1 Like