Saving command output to a specified location

The most common use for redirecting output is to save the output from query commands to a specified file or program. You can then browse the contents of the file or in some cases, print the contents.

About this task

On some operating systems, you can redirect output of a command by using special characters such as >, >>, and |. Redirection characters direct the output of a command to a file or program that you specify instead of to your screen. You can save the output from a command by entering redirection characters at the end of the command. To redirect output, leave a blank between the redirection character and the file or program name. See the following examples.

When redirecting output, follow the naming conventions of the operating system where you are running the administrative client.

Procedure

The examples in the following table show how to redirect command output.
Task Procedure
Redirect the output of a QUERY DOMAIN command to a new file in batch or interactive mode Use a single greater-than sign (>) to redirect the output to a new file or write over an existing file:

dsmadmc -credentialsfile=secretpwdfile query domain acctg > dominfo.acc

Append the output of a QUERY DOMAIN command to the end of an existing file in batch or interactive mode Use two consecutive greater-than signs (>>) to append the output to the end of an existing file:

dsmadmc -credentialsfile=secretpwdfile query domain acctg >> dominfo.acc

Redirect all output from an administrative client session in console mode to a program called filter.exe Use the vertical bar (|) to direct all output for a session to a program:

dsmadmc -console -credentialsfile=secretpwdfile | filter.exe

The program can be set up to monitor the output for individual messages as they occur and take appropriate action, such as sending mail to another user.

In console mode, redirect all output to a file Specify the -OUTFILE option with a destination file name. For example, the following command redirects all output to the save.out file:

dsmadmc -credentialsfile=secretpwdfile -consolemode -outfile=save.out