how to grep from specific field | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

how to grep from specific field

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-23-2008
tiff-matt tiff-matt is offline
Registered User
 
Join Date: Jul 2008
Last Activity: 12 January 2009, 2:41 PM EST
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
how to grep from specific field

the file has several date fields.for example, #2, #3,and #5 are date fields.
I want grep year '2002' just within #2 field and get all the rows which content year '2002' in the #2 field. is it possible to do this? how to do it? Thanks
Sponsored Links
    #2  
Old 07-23-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
 
Join Date: Mar 2005
Last Activity: 5 July 2014, 11:14 AM EDT
Location: classification algos
Posts: 3,203
Thanks: 19
Thanked 30 Times in 27 Posts
Welcome to the forums !

You could have searched the forums for 'n' number of answers.


Code:
awk '$2 ~ 2002' filename

Sponsored Links
    #3  
Old 07-23-2008
tiff-matt tiff-matt is offline
Registered User
 
Join Date: Jul 2008
Last Activity: 12 January 2009, 2:41 PM EST
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL Thank you muck

Thanks a lot for the prompt reply, i'll try the command
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace specific field on specific line sed or awk crownedzero Shell Programming and Scripting 14 11-27-2011 03:34 PM
awk how to replace specific field with new value setepo Shell Programming and Scripting 10 04-07-2011 10:17 AM
Help with grep at specific field of a file techmoris Shell Programming and Scripting 7 10-21-2010 11:21 AM
Removing parts of a specific field kieranh Shell Programming and Scripting 9 09-28-2007 12:52 PM
Grep for NULL for a specific field in a unix file sureshg_sampat UNIX for Dummies Questions & Answers 5 11-24-2006 08:21 AM



All times are GMT -4. The time now is 02:15 PM.