in reply to vanishing system call

Is it possible someone's put a program or script named either "cat" or "sort" somewhere on your path before /usr/bin?

Another possibility: did you chdir somewhere else in your script? $file may not be in the current directory, in that case.

You're also needlessly using cat. It probably doesn't matter, but why not just do this:

system("sort -t\\| +1 -2 -o $file.out $file");
Also, make sure sort is on the path when the script runs; if it runs from a crontab or webserver, it might not be.

It's probably safer to do:

system("/usr/bin/sort -t\\| +1 -2 -o $file.out $file");
You might have to change the /usr/bin if that's not where your sort binary is.
--
Mike