The system function does expand its parameters so there is nothing specific to do. Your example will work if you tell what to do with the files which you fail to.
Thanks Jean-Pierre for opening my eyes !
I overlook this is the shell programming and scripting forum :o
In any case, awk "system()" behave the same way as the C standard library one, i.e. it expands its parameters. Too bad aobai provides no more clues ...
There is nothing wrong with the code in the original post. If it's not working, please be clear about how it is failing. Post any error messages if any. Also, try enabling tracing in the shell that's being used:
system("set -x; rm -f /tmp/*.tmp");
Also, please post the entire program, or a minimized version that exhibits the same problem. Perhaps the error is in the surrounding code. Although, we can't even guess because not only have you not specified the error at all, there is even some doubt as to what programming language is being used.
Assuming that it's AWK, here's a test run showing how globs work just fine with the system function:
$ awk -f system.awk
1.txt 2.txt 3.txt
+ rm -f 1.txt 2.txt 3.txt
ls: *.txt: No such file or directory
The first line is ls showing us that the files were created successfully by touch. The second line is the trace output from 'set -x', showing the rm command that will run (as you can see, the .txt pattern was expanded correctly). The final line is ls complaining that nothing matched '.txt', which is expected since in that empty directory, there is nothing for the pattern to match and no file matches the unexpanded string '*.txt'.