将文本文件过滤到新的文本文件中 [英] Filter a text file into a new text file
问题描述
很抱歉在这里有假人问题.
Sorry about the dummy question here.
在Windows下,我希望能够将一个.txt文件过滤为一个新文件.过滤所有包含特定字符串的行.
Under Windows I would like to be able to filter one .txt file into a new one. Filtering all lines that contain a specific string.
我知道这很容易实现,但是请多多指教.
I know this could well be a really easy one, but would really appreciate a few pointers please.
推荐答案
使用findstr
命令:
findstr my-string filename > new-file
findstr /?
将为您提供一条用法消息,告诉您如何使用findstr
(包括/V
开关,如果您想过滤 out 行而不是过滤它们 in .)
findstr /?
will give you a usage message telling you how to use findstr
(including the /V
switch if you wanted to filter lines out rather than filtering them in.)
或者,如果您熟悉grep
,并希望在Windows上安装它,请安装 Cygwin . :-)
Or if you're familiar with grep
and wishing you had it on Windows, install Cygwin. :-)
这篇关于将文本文件过滤到新的文本文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!