Solved I want to verify the field is lowercase

June 24, 2011 at 10:27:37
Specs: Windows XP
I want to verify the field is lowercase. I have a field that I want to check and make sure the field contains all lowercase letters, and error if not. How do I do it?

See More: I want to verify the field is lowercase

Report •

#1
June 24, 2011 at 12:29:22
✔ Best Answer
Since you are in the Linux forum, I am assming you want a bash script of some type?

This script using awk checks the second field of each line in file datafile. If one of the fields is anything but lower case letters, it prints an error:

#!/bin/bash

awk '
{
if($2 !~ /^[a-z]*$/)
   print "field 2 is not lower case"

} ' datafile


Report •
Related Solutions


Ask Question