Windows相当于'tail'命令 [英] Windows equivalent of the 'tail' command

查看:995
本文介绍了Windows相当于'tail'命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以在DOS中模拟* nix tail 命令吗?我有一个文件,我想要一个方法来剪断前n行文本。例如:

Is there a way to simulate the *nix tail command in DOS? I have a file and I want a way to snip off the first n lines of text. For example:

D:\>type file.txt
line one
line two
line three
D:\>*[call to tail]* > result.txt

D:\>type result.txt
line two
line three


推荐答案

没有完全相同。但是,存在一个本机DOS命令more,它有一个+ n选项,将在第n行之后开始输出文件:

No exact equivalent. However there exist a native DOS command "more" that has a +n option that will start outputting the file after the nth line:

DOS提示符:

C:\>more +2 myfile.txt

上述命令将输出前两行之后的所有内容。

这实际上是Unix head 的反义:

The above command will output everything after the first 2 lines.
This is actually the inverse of Unix head:

Unix控制台:

root@server:~$ head -2 myfile.txt

上述命令只会打印文件的前两行。

The above command will print only the first 2 lines of the file.

这篇关于Windows相当于'tail'命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆