The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Convert two column data into 8 columns NickC Shell Programming and Scripting 8 06-28-2008 08:19 AM
Count first column on the basis of two other columns kaustubh137 Shell Programming and Scripting 1 05-29-2008 05:54 AM
How to check Null values in a file column by column if columns are Not NULLs Mandab Shell Programming and Scripting 7 03-15-2008 06:57 AM
single column to multiple columns agibbs UNIX for Dummies Questions & Answers 7 12-05-2007 07:04 PM
Sorting based on columns MobileUser Shell Programming and Scripting 7 04-11-2007 11:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-28-2008
Registered User
 

Join Date: Aug 2008
Posts: 1
Grep all the columns based on a particular column

This is the data file that I have

21879, 0, 22, 58, 388
0, -1, 300, 1219172589765, 1708, 0, 200, 21891, 0, 0, 33, 309
0, -1, 300, 1219172591478, 1768, 0, 200, 22505, 0, 0, 33, 339
0, -1, 300, 1219172593251, 1738, 0, 200, 21888, 0, 1, 33, 308
0, -1, 300, 1219172594995, 633, 0, 200, 24878, 0, 0, 33, 272
0, -1, 300, 1219172595631, 568, 0, 200, 22371, 0, 0, 34, 269
0, -1, 300, 1219172596204, 569, 0, 200, 26014, 0, 2, 35, 272
0, -1, 300, 1219172596777, 517, 0, 200, 22377, 0, 0, 33, 287

I need to grep all the columns based on the third column value from the left. For example in this case I want all the columns and the rows based on the value of '300'

Could someone tell me how this can be done

Thanks
Poornima
Reply With Quote
Forum Sponsor
  #2  
Old 08-28-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
What does "all the columns and the rows based on the value of '300'" mean?

Code:
awk -F , '$3 == 300' file
... perhaps?
Reply With Quote
  #3  
Old 09-03-2008
Registered User
 

Join Date: Jun 2008
Posts: 9
awk -F "," '($3 == 300) {print $0}' filename
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0