General
cancel
Showing results for 
Search instead for 
Did you mean: 

Need a perl script to check for the column digits

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