【发布时间】:2010-09-23 14:59:19
【问题描述】:
字符 >(或 >>)可以与 Windows 中的命令一起使用,以将命令的结果记录到文件中。 Linux有这个能力吗?你怎么做呢?
示例: $ find /?>find.txt
此命令将在当前目录中创建一个名为 find.txt 的文件。该文件将包含键入命令后在术语窗口中找到的内容:
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.
If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
【问题讨论】:
-
一个有趣的特性是空特性。在 Windows 上:
echo "hello world" > NUL在 Linux 上:echo "hello world" > /dev/null