The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 08-14-2007
lorcan lorcan is offline
Registered User
 

Join Date: May 2007
Posts: 214
Code:
awk -F"\t" '{if ($2 !~ /[A-Za-z ]/) {print $2 "\t valid"; } else {print $2 "\t invalid";}}' filename
Output
Code:
123      valid
1 23     invalid
123AB    invalid
ABD123   invalid
12345    valid
NOPE     invalid
1234     invalid
or if you want to drop those which are alphanumberic,try

Code:
awk -F"\t" '$2 !~ /[A-Za-z ]/ { print $0 }' filename
Reply With Quote