Hi
I want to print lines 20-30 from a file.
In UNIX , this command will work
sed -n '20,30p' file
However what is the equivalent command in DOS ?
Pls help me !
Hi
I want to print lines 20-30 from a file.
In UNIX , this command will work
sed -n '20,30p' file
However what is the equivalent command in DOS ?
Pls help me !
Moved to Windows & DOS: Issues & Discussions.
---------- Post updated at 01:50 PM ---------- Previous update was at 09:55 AM ----------
Save the following script as print_range.vbs:
Set objFSO = CreateObject("Scripting.FileSystemObject")
myFile = WScript.Arguments.Item(0)
myStart = WScript.Arguments.Item(1)
myEnd = WScript.Arguments.Item(2)
Set objFile = objFSO.OpenTextFile(myFile)
Do Until objFile.AtEndOfLine
numRec = objFile.Line
Rec = objFile.ReadLine
If numRec >= CInt(myStart) And numRec <= CInt(myEnd) Then
WScript.Echo Rec
End If
Loop
Execute it like this:
cscript -nologo print_range.vbs infile 20 30
Hello
thnx for ur reply
However i don't want to use script.
I got the solution for that.
I am using
for /f "skip=20 tokens=* delims= " %%a in (test.txt) do (
set /a Start+=1
echo !Start!, %%a >>LogOut1.csv
if !Start!==30 GOTO END
)