This command is used together with the command re-targeting Pipeline character (|). The command filter is a command that contains the input that can read the command, the convertible input, and the output command. The filter command can help you sort, view, and select some command output.
Filter commands can be used to divide, rearrange, and extract part of the information that passes. The following table lists the filter commands available in Windows XP.
Command description
More displays the content of a file or the output of a command each time in a command prompt window.
Find searches for the specified characters in the file and command output.
Sort arranges files and command output alphabetically.
To send the input from the file to the filter command, use a smaller sign (<). If you want to use the filter command to obtain input from other commands, use the pipeline (| ).
Use the more command
The more command displays the content of a file or the output of a command each time in a command prompt window. For example, to display the content of a file named list.txt in a command prompt window, type:
More <list.txt
A Command Prompt window containing information appears, and the -- more -- prompt appears at the bottom of the Command Prompt window. To continue to the next Command Prompt window, press any key (except pause) on the keyboard ). To stop the command without viewing details, press Ctrl + C.
You can use the more command to generate multiple Command Prompt window commands. For example, suppose you want to view the directory tree on the hard disk. If the command prompt window cannot display all directories on one screen, use the Tree Command with pipeline (|) and more commands, as shown in the following example:
Tree c: \ | more
The first output Command Prompt window generated by the Tree Command appears, followed by the -- more -- prompt. The output is paused until you press any key on the keyboard (except the pause key ).
Use the find command
The find command searches for the specified string or text in the file. Cmd.exe displays all rows that match the specified string or text in the Command Prompt window. You can use the find command as a filter command or as a standard Windows XP command. For more information about how to use find as a standard command, see find.
To use the find command as a filter command, you must include the sign (<) and the string or text to be searched. By default, find search is case sensitive. For example, the following command looks for all the "Pacific Rim" strings in the file trade.txt:
Find "Pacific Rim" <trade.txt
The output does not include any string that appears "Pacific Rim. The output contains only the "Pacific Rim" string with uppercase letters.
To save the output of the find command rather than display the output in the Command Prompt window, type a file name larger than the sign (>) and the file to store the output. For example, the following command finds the "Pacific Rim" string in the file trade.txt and saves the result in the nwtrade.txt file:
Find "Pacific Rim" <trade.txt> nwtrade.txt
Use the sort command
The sort command sorts the output of text files or commands alphabetically. For example, the following command sorts the content of a file named list.txt and displays the sorting result in the Command Prompt window:
Sort <list.txt
In this example, the sort command sorts the lines in the list.txt file by letter list and displays the results without changing the file. To save the output of the sort command rather than display the output, type a file name larger than the number (>. For example, the following command sorts the lines of the list.txt file alphabetically and stores the results in the alphlist.txt file:
Sort <list.txt> alphlist.txt
To sort the command output, type the command, type pipeline (|), and then type sort (that is, command | sort ). For example, the following command sorts the rows that contain the string "Jones" (that is, the find command output) alphabetically:
Find "Jones" maillst.txt | sort