切在Windows相当于 [英] cut equivalent in Windows
问题描述
我也有条目下面的文件。
/ A / B / C / D / E / F
/ A / B / C / G / K / L / F / J / h的
/ A / B / C / I / M / N / P
我需要在Windows命令将其删除/ A / B / C
部分从文件。
输出文件应该看起来像
D / E / F
克/ K / L / F / J / h的
I / M / N / P
我尝试使用与命令/作为分隔符,但不能得到预期的结果。
任何人都可以请帮助?
关闭@echo(FOR / F令牌= 3,* delims = /%%一中(input.txt中)做回声%% B)> output.txt的
和的绝招是问第三令牌和行的其余部分。
要直接在命令行中使用它。
(FOR / F令牌= 3,* delims = /,在(input.txt中)做@echo%B%A)GT; output.txt的
转义百分号简化工作,并从命令行呼应了
默认不启用, @
在回声
需要
I have a file which has entries as below.
/a/b/c/d/e/f
/a/b/c/g/k/l/f/j/h
/a/b/c/i/m/n/p
I need a command in windows which would remove the '/a/b/c'
part from the file.
The output file should look like
d/e/f
g/k/l/f/j/h
i/m/n/p
I tried using for command with / as delimiter, but couldn't get the expected result. can anyone please help?
@echo off
(for /f "tokens=3,* delims=/" %%a in (input.txt) do echo %%b) > output.txt
And the "trick" is to ask for the third token and the rest of the line.
To use it directly from command line
(for /f "tokens=3,* delims=/" %a in (input.txt) do @echo %b) > output.txt
The escaped percent signs are simplified and, as from command line the echo off
is not enabled by default, the @
before echo
is needed
这篇关于切在Windows相当于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!