BAT文件的读取,并从文本文件复制下16行到另一个? [英] BAT file to read and copy bottom 16 lines from a text file to another one?

查看:99
本文介绍了BAT文件的读取,并从文本文件复制下16行到另一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在底部的16条线路从文本文件复制到另一个文本文件。我需要为所有的客户端做这个程序。在客户端的位置文本文件将是共同但底部16行是包安装的确认很重要的。

I need to copy the bottom 16 lines from a text file to another text file. I need to do this procedure for all clients. At the client's location the text file will be common but the bottom 16 lines is important for confirmation of package installation.

推荐答案

更多命令可以用于提取最后N行:

The more command can be used to extract the last n lines:


  1. 如果一个文件,someFile.txt,包含2000行,那么最后16行可以提取:

  1. If a file, someFile.txt, contains 2000 lines then the last 16 lines can be extracted with:

more /e +1984 someFile.txt > lastLines.txt


  • 在someFile.txt线的数目可以为实测值:

  • The number of lines in someFile.txt can found as:

    for /f %%i in ('find /v /c "" ^< someFile.txt') do set /a lines=%%i
    


  • 的通话更多就变成了:

    set /a startLine=%lines% - 16
    more /e +%startLine% someFile.txt > lastLines.txt
    


  • 这篇关于BAT文件的读取,并从文本文件复制下16行到另一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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