Grep and append

Have a string as below in a file.

"

anohter boy has id 000921 and girl has id=655 of roll number

"

using grep below commands with grep commands but able to get one string at a time, not able to append.

less <filename> | grep -o -P '(?<=id ).*(?=and )'
 
less <filename> | grep -o -P '(?<=id\= ).*(?=of )'

how to get output as :

000921 655

thanks

try

grep -o -P '(?<=id ).*?(?= and )|(?<=id=).*?(?= of )' filename | paste -d " " - -

Or

grep -Po '(?<=id( |=)).*?(?= (and|of) )' filename | paste -d " " - -