Technically you would be redirecting the output to a file, not piping it to a file. If you issue top with the -b switch it runs in batch mode, meaning it does one iteration and exits. What you can do is pipe that output to grep, awk, cut, tr, whatever and manipulate that output to whatever output you like, then redirect it to a file for use somewhere else.
There has to be a way to do this with ps though. I just don't feel like reading through all of the man page on ps to find out how to manipulate the output accordingly. You can manipulate tops output as well with switches, etc.