I want to extract the numbers following client_id and id and pair up client_id and id in each line.
For example, for the following lines of log,
User(cli
This might work for you (GNU sed):
sed -r '/.*(\(client_id:([0-9]+))[^(]*\(id:([0-9]+)/!d;s//\2 \3\n\1/;P;D' file
/.*(\(client_id:([0-9]+))[^(]*\(id:([0-9]+)/!d
if the line doesn't have the intended strings delete it.s//\2 \3\n\1/
re-arrange the line by copying the client_id
and moving the first id
ahead thus reducing the line for successive iterations.P
print upto the introduced newline.D
delete upto the introduced newline.