LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cut / awk command?? (https://www.linuxquestions.org/questions/linux-newbie-8/cut-awk-command-62159/)

Sammy2ooo 05-27-2003 05:34 PM

cut / awk command??
 
Hi everybody

i got a question regarding line based searching
if i have file which looks for example like this:

Quote:

Host: 192.168.100.2 () bla 123
Host: 192.168.100.3 () bla 123
Host: 192.168.100.4 () bla 123
Host: 192.168.100.5 () bla 123
Host: 192.168.100.6 () bla 123
how am i able to extract only the ips??
afterwards it should look like this:

Quote:

192.168.100.2
192.168.100.3
192.168.100.4
192.168.100.5
192.168.100.6
cat file | grep Host: doesn't work and couldn't find any option to extract the ips

i heard of a awk command but don't know how the heck to use it to realize this

Any help or hint would be apreciated


Friendly Regards

Sam

awdoyle 05-27-2003 05:46 PM

$ awk '{print $2}' filename

Andrew


All times are GMT -5. The time now is 03:15 PM.