How to replace `peer_id` with `alias` in c-lightning?

There are commands like lightning-cli listpeers and lightning-cli listfunds.

How do I replace the peer_id in the output of the commands with the alias of the peer?

I know about the jq command line tool to parse JSON and that i can get the alias with lightning-cli listnodes $peer_id. But I am having a hard time achieving the desired output. I think it should be doable with the use of jq. But maybe there is another way I am not thinking about. Maybe Python? But I would prefer just the standard unix tools if possible.