LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-27-2003, 05:34 PM   #1
Sammy2ooo
Member
 
Registered: Jan 2003
Location: nearby switzerland
Distribution: Suse 8.0 / Suse 9.0 / Slackware 9.1 / Debian Sarge testing / Gentoo 1.4.10
Posts: 165

Rep: Reputation: 30
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
 
Old 05-27-2003, 05:46 PM   #2
awdoyle
Member
 
Registered: Aug 2002
Location: Portland, OR
Distribution: Xubuntu
Posts: 135

Rep: Reputation: 15
$ awk '{print $2}' filename

Andrew
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash cut command to get df percentage nutthick Programming 8 12-16-2010 11:02 AM
How do I cut out a specific piece of a html page (using sed/awk or similar)? bomix Linux - General 2 10-08-2005 04:30 PM
finger and cut command Craig Bowes Linux - Newbie 3 10-09-2004 12:49 PM
Cut Command Help!! fooforon Programming 2 02-05-2004 10:09 AM
Easy: Help with Cut command Krash_io Programming 4 07-17-2002 02:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration