Hi,
I am trying to classify the strings of a column as 3 categories: "pureones" when the whole string is composed of the character 1, of different lengths, the same for "purezeros" and the rest being "mixed".
I have this version below which isn't working fully because I can't check for different lengths of "pureones". For example, if the value is 111 or 1111 or 11111 or 1111111 it won't match it as pureones. How would I do that? Thanks
echo -e "foo\n111111\n1100\n0000\n00000111\n111001000" | csvtk mutate2 -n type -e '$foo == 111111 ? "pureones" : ($foo == 00000 ? "purezeros" : "mixed")'
foo,type
111111,pureones
1100,mixed
0000,purezeros
00000111,mixed
111001000,mixed
Bests,
Hi,
I am trying to classify the strings of a column as 3 categories: "pureones" when the whole string is composed of the character
1, of different lengths, the same for "purezeros" and the rest being "mixed".I have this version below which isn't working fully because I can't check for different lengths of "pureones". For example, if the value is
111or1111or11111or1111111it won't match it as pureones. How would I do that? ThanksBests,