ohade
ohade

Reputation: 161

process specifics line from text file

i want to insert to text file like this: (the content of the text file is not like this, this is only example):

This Is The 1 line
This Is The 2 line
This Is The 3 line
This Is The 4 line
This Is The 5 line
This Is The 6 line
This Is The 7 line
This Is The 8 line
This Is The 9 line
This Is The 10 line
This Is The 11 line
This Is The 12 line
This Is The 13 line
This Is The 14 line

the new file will be like this:

This Is The 1 line
This Is The 2 line
This Is The 3 line
This Is The 4 line
This Is The 5 line
This Is The 6 line
This Is The 7 line
This Is The 8 line
This Is The 9 line
This Is The 10 line
NEW INPUT HERE
This Is The 11 line
This Is The 12 line
This Is The 13 line
This Is The 14 line

my question is how to process line 1-10, insert some text, and afterwords process line 11-14?

Upvotes: 1

Views: 32

Answers (1)

foxidrive
foxidrive

Reputation: 41234

Here is one robust way to do it:

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.

@echo off
(
type "file.txt"|findrepl /o:1:10 
echo NEW INPUT HERE
type "file.txt"|findrepl /o:11
) > "newfile.txt"

Upvotes: 1

Related Questions