Question: How to extract a text part by regexp in linux shell? Lets say, I have a file where in every line is an IP address, but on a different position. What is the simplest way to extract those IP addresses using common unix command-line tools?

Answer: 
I wrote a little [script](http://digitalcrunch.com/perl/extract-ipv4-address-from-text-using-perl/) to see my log files better, it's nothing special, but might help a lot of the people who are learning perl. It does DNS lookups on the IP addresses after it extracts them.
You could use awk, as well. Something like ...

```
awk '{i=1; if (NF > 0) do {if ($i ~ /regexp/) print $i; i++;} while (i <= NF);}' file

```

May require cleaning. just a quick and dirty response to shows basically how to do it with awk.