I'm trying to have awk print only a specific information. I can make it when it comes only to simple text strings. But its not working when I ask to search and print something like:
/[0-9]*\.[0-9]*\.[0-9]*\.[0-99]*\.[0-999]*/
I'm looking for numbers separated by dots, almost like IP address. For example:
#.#.#.##.### where #=integer
For example:
This prints only TEXT
and works fine.
awk '{for(i=1;i<=NF;i++){ if($i==“TEXT”){print $i} } }' source.txt > result.txt
This should print what I need, but doesn't work.
awk '{for(i=1;i<=NF;i++){ if($i==“/[0-9]*\.[0-9]*\.[0-9]*\.[0-99]*\.[0-999]*/”){print $i} } }' source.txt > result.txt
This works fine but prints the whole line, and not only what I need:
awk -F"\t" '/[0-9]*\.[0-9]*\.[0-9]*\.[0-99]*\.[0-999]*/{ print }' source.txt > result.txt
What am I doing wrong?