I wanted to know if there a way to save the output from top or atop commands into a textfile for later processing.

`atop|top > output.txt` is not really working at both top and atop keep running in the background.

edit:

OS: RHEL 6

other attempts: `top | awk 'fflush(stdout)'`