batch program needed

April 10, 2009 at 13:21:50
Specs: Windows XP

I am not intending to learn batch programming now. So will have to try your solutions without giving much thoughs/ going through it.

I have a huge test file (3.63 MB) out of which i want to extract only every 10th line into another text file. I got a batch code through online search but it seems to do nothing or takes a very long time. Can someone help me out here please?

Thanks in advance!

PS: I promise to learn batch programming whenever I find some breather.

See More: batch program needed

Report •

April 10, 2009 at 17:50:26
if you have gawk for windows(see my sig), this is just what you need
c:\> awk "NR%10==0" file > newfile

Unix Win32 tools | Gawk for Windows

Report •

April 10, 2009 at 23:32:45
:: get every tenth line

@echo off > newfile & setLocal EnableDelayedExpansion

set N= & set R=

for /f "tokens=* delims=" %%a in (myfile) do (
set /a N+=1
set /a R=N%%10
if !R! equ 0 echo %%a >> newfile

If at first you don't succeed, you're about average.


Report •

Related Solutions

Ask Question