#include <stdio.h>
int main()
{
const char* var_text = "cat /etc/passwd | cut -f1 d: | sort";
char cm1[100];
char cm2[100];
char cm3[100];
if (3 == sscanf(var_text
, "%99[^|]| %99[^|]| %99s", cm1
, cm2
, cm3
))
{
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgoKCmludCBtYWluKCkKCnsKCiAgICBjb25zdCBjaGFyKiB2YXJfdGV4dCA9ICJjYXQgL2V0Yy9wYXNzd2QgfCBjdXQgLWYxIGQ6IHwgc29ydCI7CgogICAgY2hhciBjbTFbMTAwXTsKCiAgICBjaGFyIGNtMlsxMDBdOwoKICAgIGNoYXIgY20zWzEwMF07CgogICAgaWYgKDMgPT0gc3NjYW5mKHZhcl90ZXh0LCAiJTk5W158XXwgJTk5W158XXwgJTk5cyIsIGNtMSwgY20yLCBjbTMpKQoKICAgIHsKCiAgICAgICAgcHJpbnRmKCI8JXM+XG4iLCBjbTEpOwoKICAgICAgICBwcmludGYoIjwlcz5cbiIsIGNtMik7CgogICAgICAgIHByaW50ZigiPCVzPlxuIiwgY20zKTsKCiAgICB9CgogICAgcmV0dXJuIDA7Cgp9Cgo=