0

如果我例如使用findstr /g:Filters/test.ini < "ServerLogs/users.log" > "Logs/filtered_users.txt

我想先搜索并写下该行,然后删除/覆盖例如“ServerLogs/users.log”中的一行

我必须设置什么?

例如:“ServerLogs/users.log”

JacktheRiver IP:18.184.284.91 - SETPATHDOWN 394858913857869284 #10 39485918238584378
Laste3r IP:72.125.68.141 - SETPATHDOWN 346343253563467578 #22 35354634679795373
Rus48rr IP:63.215.154.23 - SETPATHDOWN 543534694689128453 #12 49348376384678221
TOkiN1 IP:54.132.146.41 - SETPATHDOWN 343543346363643644 #41 42395833891883585

然后举个例子。Rus48rr IP:63.215.154.23 - SETPATHDOWN 543534694689128453 #12 49348376384678221并将其保存到“filtered_users.txt”中。从“ServerLogs/users.log”中删除这一行后,它会像这样结束:

JacktheRiver IP:18.184.284.91 - SETPATHDOWN 394858913857869284 #10 39485918238584378
Laste3r IP:72.125.68.141 - SETPATHDOWN 346343253563467578 #22 35354634679795373
TOkiN1 IP:54.132.146.41 - SETPATHDOWN 343543346363643644 #41 42395833891883585

这可能吗,如果可以,怎么办?

4

1 回答 1

1

您可以找到匹配的行:

findstr /g:Filters/test.ini < "ServerLogs/users.log" > "Logs/filtered_users.txt"

/v您可以找到与参数不匹配的行:

findstr /g:Filters/test.ini /v < "ServerLogs/users.log" > "ServerLogs/users.tmp"

users.log然后您可以用新users.tmp文件覆盖。

于 2013-01-30T09:48:39.787 回答