I have awk
script file as below. I need to add another condition in the if
statement to check if the string contains atleast one alphabet. How can I add the extra condition to the present if
statement?
Required regex condition: [[ "$1" =~ [A-Za-z] ]]
BEGIN { FS = ";"; counter=0}
{
if ((length($1) != 10 && length($1) != 12))
{
counter++
print counter, $1;
if ($counter -gt 2){
print "Invalid input file";
exit;
}
}
}
I am getting error if I use the same condition which I have posted. How to add the condition?
[A-Za-z]
. What are you adding to yourawk
? – terdon♦ Apr 15 '19 at 12:34