My problem is to determine via shell script if certain strings are permutations of each other e.g.
1.Nf3 c5 2.e4 Nc6
1.e4 c5 2.Nf3 Nc6
As you can see the permutation is based on atomic substrings. So in other words, I want to know if both strings containing same substrings without consider the order.
AWK is a programming language designed for advanced text processing. So one idea that comes up is to split both strings into arrays:
{1., Nf3, c5, 2., e4, Nc6}
{1., e4, c5, 2., Nf3, Nc6}
and compare if both consists same elements. But I'm not sure if this fits awk way.
A second approach is to split the first string into patterns {1., Nf3, c5, 2., e4, Nc6}
and search in the second string for all patterns and create a new string based on those matches. After all I could check if the new string is equal to the first string. Are there any other approaches in awk for this specific text processing?