dos commands
|
Original Message
|
Name: noodyblum
Date: April 10, 2005 at 05:10:08 Pacific
Subject: dos commandsOS: win xpCPU/Ram: p4/256mb |
Comment: Is there a dos command that can count the number of lines in a text file. In unix there is wc -l. I am looking for a similar command in dos/windows
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Mechanix2Go
Date: April 10, 2005 at 05:28:25 Pacific
Subject: dos commands |
Reply: (edit)DOS has FIND, which you can use like this: find /v /c "z z z z " filename the /v tells it 'non-matching lines' and you give it some string which is almost surely not there. The /c tells it 'line count only'. M2 If at first you don't succeed, you're about average.
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: noodyblum
Date: April 10, 2005 at 06:06:47 Pacific
Subject: dos commands |
Reply: (edit)Hi M2 Thanks for the quick reply. Works like a charm. I have one last question. In unix you have a tail command which shows the last 20 lines in a file. Is there something similar in dos. Basically I need to read the last line in the text file without reading through the whole file. Thanks Noody
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: dtech10
Date: April 10, 2005 at 06:53:03 Pacific
Subject: dos commands |
Reply: (edit)Hi Something like this help. @echo off for /f "tokens=*" %%a in (File.txt) do set LastLine=%%a echo %LastLine%
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: