Hello I have the below awk in my script . The regex pattern is not working correctly for me .I wanted to validate the email address which can have characters [a-z],[0-9] ,[.] ,@
code
here are the sample email patterns in the input file
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
the pattern is extracted from a metadata file and passed as a script paramter .here is the metadata line defines the pattern for email id validation
1~4~~~char~Y~\"\@\.com\"~100
sh -x run for the script code
val=$(
awk -F ,
-v n=4
-v 'm="*@*.com"'
-v count=0
'NR!=1 && $n !~ "^" m "$"
{
printf "%s:%s:%s\n", FILENAME, FNR, $0 > "/dev/stderr"
count++
}
END {print count}' BNC.csv
vi of the script code
val=$(awk -F "$sep"
-v n="$col_pos"
-v m="$col_patt"
-v count=0
'NR!=1 && $n !~ "^" m "$"
{
printf "%s:%s:%s\n", FILENAME, FNR, $0 > "/dev/stderr"
count++
}
END {print count}' $input_file