China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-30 01:05
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [Help] How to get the line number of a specific string in a file under DOS? View 666 Replies 1
Original Poster Posted 2006-03-13 17:49 ·  中国 山西 临汾 联通
初级用户
Credits 176
Posts 16
Joined 2004-10-02 00:00
21-year member
UID 32054
Gender Male
Status Offline
For example, in a.txt, if it contains the string "abieowdiwoduweiw", how can I get the line number where it is located and store it in a variable? Environment: DOS7.1
Floor 2 Posted 2006-03-13 20:11 ·  中国 湖北 荆门 电信
荣誉版主
★★★
Credits 2,013
Posts 718
Joined 2006-02-18 07:07
20-year member
UID 50550
Status Offline
Never used DOS 7.1
But both find and findstr in CMD have a /n parameter that can find line numbers
You can check whether 7.1 has them.
Forum Jump: