The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to sort alphabetically after finding values doubleminus UNIX for Dummies Questions & Answers 4 04-28-2008 03:45 AM
Converting Binary decimal coded values to Ascii Values gaur.deepti UNIX for Advanced & Expert Users 3 04-02-2008 09:33 AM
Finding a specific UID on a site with hundreads of users. maxalarie AIX 1 03-03-2008 10:17 AM
Finding a specific pattern from thousands of files ???? aarora_98 Shell Programming and Scripting 6 02-17-2006 05:28 AM
How to read specific lines in a bulk file using C file Programming rajan_ka1 High Level Programming 10 11-10-2005 12:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-04-2005
Registered User
 

Join Date: Jun 2005
Location: Alexandria, Scotland
Posts: 46
finding specific values in a within a file

Hi everyone,

Can anyone guide me on how to search through a huge file and look on specific column and if it finds a discrepancy on that column that does not conform to the specified criteria,

ie

(1) Numeric and (3) alpha chars F123 or G333..etc, etc!

then idientify it and redirect that whole row to a some newfile.txt


ie input file .....

john watson F300 2005 234567
mary millington g306 2002 343567
tony hancock hi45 2004 999999
Frederick Smith T302 888883
John Semple VIiv 223441
Tony Mallony F333 867492

outputfile......

tony hancock hi45 2004 999999
John Semple VIiv 223441
Reply With Quote
Forum Sponsor
  #2  
Old 10-04-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,613
awk '$3 !~ /[A-Za-z][0-9][0-9][0-9]/' < inputfile > outputfile

Should that not work, try nawk rather than awk.
Reply With Quote
  #3  
Old 10-04-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,248
Might have to match beginning/end of string, like....
Code:
awk '$3 !~ /^[A-Za-z][0-9][0-9][0-9]$/' < inputfile > outputfile
Reply With Quote
  #4  
Old 11-21-2005
Registered User
 

Join Date: Jun 2005
Location: Alexandria, Scotland
Posts: 46
matching strings

Thanks for that, it works a treat!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:36 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