Operating System - HP-UX
1748269 Members
3473 Online
108760 Solutions
New Discussion

Need a perl script to check for the column digits

 
kumar143
Occasional Contributor

Need a perl script to check for the column digits

Need a perl script to check for the col2 in the testdata ,if there is any digit below or above 8. if any digit is below or above 8 then redirect to another file.

test data:
col1,col2
111,12333333
111,456667677
123,1233333

output file should be like this:
111,456667677
123,1233333
1 REPLY 1
Dennis Handly
Acclaimed Contributor

Re: Need a perl script to check for the column digits

I assume you meant the length or width of the second field was not 8.
awk -F, 'length($2) != 8' file