中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 03:33
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Help] How can the sed command determine the line number of an overlong line?
Printable Version  913 / 4
Floor1 rockyuan Posted 2010-06-21 17:28
初级用户 Posts 21 Credits 21
Right now I have a text file, and inside it there is one very long line. The contents of the line are character, tab, character, tab.....

After opening it with Notepad, I found that this line is already displayed as 3 lines (word wrap is not enabled).
(When opened with excle I found it is 1 line, and it has already extended to column IG, with probably more than 270 tabs)

So would sed treat this as one line or 3 lines?

Also, how does the sed command recognize tabs (what is the wildcard for tabs)?
Floor2 genteman Posted 2010-06-21 17:55
初级用户 Posts 43 Credits 90
Use a regular expression to identify lines; the line-ending symbol is $. The several lines you see are just a display issue. You can try opening it with ultraedit and have a look.

Tabs are generally represented with \t.
Floor3 rockyuan Posted 2010-06-21 18:19
初级用户 Posts 21 Credits 21
After checking the hex, I found that this line really has only one 0D 0A
But why can't sed "line number"d filename delete it?
The line number is the one shown in the status bar.
Floor4 genteman Posted 2010-06-21 19:02
初级用户 Posts 43 Credits 90
Could it be that the sed command was written incorrectly?

Under unix it is generally written like this:
sed 'm,nd' means deleting the content from line m through line n.
Floor5 HAT Posted 2010-06-21 21:05
版主 Posts 5,017 Credits 9,023
1 line
\t
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023