Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

How to escape a dot in vim command?

I have a text file with with about a hundred lines of text and they all look like this :

TESS-1.2106292       0.00738417          14.3882          161.091       NO 
TESS-1.2103594        0.0147372          13.0787          159.067       NO

and I want them to look like this :

2106292       0.00738417          14.3882          161.091       NO 
2103594        0.0147372          13.0787          159.067       NO

I have to combine d with a motion and I have to escape the dot so I tried using the command :1,$norm df. but it did not work. Am making a mistake while escaping the dot ?

question from:https://stackoverflow.com/questions/65894001/how-to-escape-a-dot-in-vim-command

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
:%norm 0df.

%: for all lines

0: move the cursor to the beginning of line

df.: delete from the cursor to the first dot (include the dot)

EDIT

As @romainl said, 0 is not necessary in this case. But if you run :norm instead of :%norm, 0 would be necessary.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...