I have strings that are supposed to match with numbers.
For example,
one is equal to 1
Now, I have a file that separates columns with ; and I want to write an awk expression that checks if the SUM of the first column $1 is equal to $2.
Here is an example of how the file is structured
oNe-oNE ; 2
one-too ; 1
SOLUTION [needs improvement] I have it working with only two arguments for the string, like one-one, but I need to adapt it to accept more, like One-TOO-pots-one-one (unlimited really).
awk 'BEGIN{n=split("one 1 too 2 hello",b," ");for (i=1;i<n;i+=2) a[b[i]]=b[i+1]} {split($1,c,"-");f=tolower(c[1]);s=tolower(c[2]);print $0,"; "(a[f]+a[s]==$3?"match":"not")}' file