Solved

Regular Expression for checking valid value from file

Posted on 2007-04-03
4
1,232 Views
Last Modified: 2013-12-26
This is kind of urgent. I was wondering if someone can help me with a regular expression that checks for:

VIN should have only A-Z, 0-9 characters, but not I, O, or Q
Last 6 characters of VIN should be a number
VIN should be 17 characters long.

I have a text file which contains all the VINs one after the other. So I need to read each VIN from the file
and find out the ones which are not valid.

An actual example is helpful. The script is written in korn shell.

Thanks
0
Comment
Question by:hcdev
4 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 250 total points
ID: 18847468
cat YourDataFile  | egrep -e '^[A-HJ-NPR-Z0-9]{17}$' | egrep -e '[0-9]{6}$'
0
 
LVL 84

Assisted Solution

by:ozo
ozo earned 250 total points
ID: 18847545
egrep -v '^[A-HJ-NPR-Z0-9]{11}[0-9]{6}$' YourDataFile
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question