Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help do a grep then get rid of the first line 1

Status
Not open for further replies.

sillyVM

Technical User
Feb 14, 2007
144
US
Hey all your guru's.
I think I asked a similar question before using these commands. But I am still having trouble with a new line. Here is what I havve
Code:
#dinosaur:~/nmap-4.20$ nmap -A 199.67.4.21 -p 21 | grep 21/tcp | cut -f1 | awk '{ print $3 }'
Warning: File ./nmap-service-probes exists, but Nmap is using /usr/local/share/nmap/nmap-service-probes for security and consistency reasons.  set NMAPDIR=. to give priority to files in your local directory (may affect the other data files too).
ftp
Is there a way I only display the second line of the output? I only want to see "ftp". (last time i was asking how to get last column i think) Is there a tutorial to learn this? Is this shell scripting? >.< Thanks for all your help in advance!
 
I fixed application and got rid of that error message. So now it displays correctly. But I still dont' know how to grep my results as desired. Any suggeted reading will be more welcome. Thanks in advance!
 
Can't quite imagine what you want. But if you want the second line only, try:

Code:
... | head -n 2 | tail -n 1

--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
I see what you mean, this is exactly what I wanted. Thank you very much. Do you know where can I learn more about these? any kind full tutorial?
 
I don't think there is any single tutorial that will teach you everything you need to know. For me it was just daily experience mucking around with all the available utilities to get my work done. Linux has given you all the tools, it's up to your imagination to piece things together.

--== Anything can go wrong. It's just a matter of how far wrong it will go till people think its right. ==--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top