I want to do a whois lookup on a list of IPs and then grep country
.
I have:
const { spawn } = require('child_process')
const ip_list = [
'192.168.1.1',
'192.168.1.2',
'192.168.1.3'
]
const process = spawn('whois', ip_list)
process.stdout.on('data', (data) => {
console.log(data)
})
Which is equivalent of running whois ip1 ip2 ip3 ...
But I want the equivalent of running whois ip1 ip2 ip3 ... | grep country
How to do that in Node?
I tried adding " | grep country" or just "grep country" to the end of ip_list
as args but that gave me a query error.