Solved Moving lines from a txt thorught batch?

May 9, 2014 at 12:21:10
Specs: Windows 7
Contents of:
a.txt b.txt

4 4
3 3
2 5
1 2
5 1

I want a dos command such as findstr or similar to look at the last line in a.txt which is the number 5, look for this same string in b.txt, and output anything below it from b.txt to c.txt which would be the numbers 2 and 1. Appreciate any help.

message edited by ssnader

See More: Moving lines from a txt thorught batch?

Report •

May 9, 2014 at 18:51:06
✔ Best Answer
@echo off>ssnad3 & setlocal
for /f "tokens=*" %%a in (ssnad1) do set z=%%a
for /f "tokens=1 delims=[]" %%b in ('find /n "%z%"^<ssnad2') do set sk=%%b
echo skipping %sk% lines in second file
(for /f "tokens=* skip=%sk%" %%a in (ssnad2) do (
echo %%a
::------ might work, semi-tested but without stringent qualifications you may be reserving for later assaults. (ie: this seems too simple...)

Report •
Related Solutions

Ask Question