Here's the problem. I'm reading from my server (centos) visit log and use Sarel Botha's ipv4 address extract grep command from here.
As my server is running a java in nohup to serve connection, and all client's ipv4 address is written in nohup.out.
Combined, if I run
tail -f nohup.out|grep -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
then I would have a list of ip address following new record on nohup.out, like
111.111.111.111
222.222.222.222
and each ipv4 address would be output in a single line.
Now, I need to fetch each ipv4 address 'greped' from nohup.out and send it to a n ip geolocation query API, the formats required for query are
GET http://example.com/api/json/111.111.111.111
or
curl http://example.com/api/json/111.111.111.111
can any one tell me how can I save the ipv4 address, then use it for query, and have the query output following my tail -f command?