1

I'm looking for solution, how to get last 450 lines from large txt document using BATCH files.

Any suggestions?

Thanks!

Volodymyr Prysiazhniuk
  • 1,897
  • 4
  • 22
  • 33
  • 1
    possible duplicate: [http://stackoverflow.com/questions/523181/cmd-exe-batch-script-to-display-last-10-lines-from-a-txt-file](http://stackoverflow.com/questions/523181/cmd-exe-batch-script-to-display-last-10-lines-from-a-txt-file) – wmz Feb 12 '12 at 11:08
  • I just posted an improved batch solution http://stackoverflow.com/a/9251975/1012053 as an answer to the question cited in the previous comment. It can efficiently print the last 450 lines without pausing. – dbenham Feb 12 '12 at 19:40

2 Answers2

2

You can get tail.exe from GnuWin32 (package TextUtils) or UnxUtils.

Then:

tail -450 file
Benoit
  • 76,634
  • 23
  • 210
  • 236
  • Can I write these 450 lines in another txt file? – Volodymyr Prysiazhniuk Feb 12 '12 at 09:46
  • 1
    @Volodymyr Prysiazhniuk: Probably you need to read the basics about batch scripts. Use `> file` to redirect output to a file, for any program, and ` 2> errfile` to redirect error messages to a 2nd file (`2>&1` to redirect the merge the errors and the standard output). – Benoit Feb 12 '12 at 09:52
0

The hybrid batch file findrepl.bat (by aacini) that uses native scripting is robust and quick on large files.

findrepl /o:-450 <file.txt >newfile.txt

This uses a helper batch file called findrepl.bat (by aacini) - download from: https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat

Place findrepl.bat in the same folder as the batch file or on the path.

foxidrive
  • 40,353
  • 10
  • 53
  • 68